<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<include
layout="@layout/view1"
android:layout_gravity="center_vertical" />
<include
layout="@layout/view2"
android:layout_gravity="center_vertical" />
</LinearLayout>
So, android:layout_gravity will be always ignored? That's really bad for code reusability... It seems like layout_margin doesn't supported either.
And here is view1.xml layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:minHeight="45dip"
android:background="@drawable/updater_background" >
<ProgressBar
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="7dip"
android:visibility="gone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
</LinearLayout>
I think this can be solved by inserting weighted layout
For example
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sample.SampleActivity">
<LinearLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp">
<--Some other Views-->
</LinearLayout>
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/my_awesome_layout"
/>
The LinearLayout can be replaced with Space, if you don't want any component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With