i'm tring to put a LinearLayout at the bottom of screen inside a ScrollView. The full code is this.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="false"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
>
<RelativeLayout
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="@+id/first"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:gravity="center_vertical"
android:layout_gravity="center"
android:id="@id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/second"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/first"
>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_margin="5dip"
/>
<LinearLayout
android:id="@+id/seperator"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_below="@+id/text"
android:background="#C7C7C7"
android:orientation="horizontal"
>
</LinearLayout>
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/seperator"
android:layout_marginBottom="10dip"
android:layout_marginTop="5dip"
android:textColor="#ff0099cc"
android:textSize="16sp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
Now, i want that this LinearLayout stay at bottom of screen.
<LinearLayout
android:id="@+id/myLinear"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="bottom"
/>
I try with android_gravity="bottom" and alignParentBottom and it stay below the others layout but not at bottom.
Remove ScrollView and put below LinearLayout inside main Relative Layout
<LinearLayout
android:id="@+id/myLinear"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
/>
it will appear at bottom of screen.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.