I want to display buttons at the bottom of the screen and the buttons are inside linearLayout4,can someone pls tell me in this, am frustated now
Problem with last linear layout containing buttons,I want to display my last linear layout i.e. of id-linearlayout4 at the bottom of the screen,so that my buttons should come at the bottom...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/pic5"> 开发者_高级运维
<LinearLayout android:orientation="vertical" android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="60dip"></LinearLayout>
<LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout5" android:layout_height="wrap_content">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/textView2"
android:layout_marginLeft="19dp"
android:id="@+id/quesname"
android:textSize="20dip"
android:textColor="#000000"></TextView>
</LinearLayout>
<LinearLayout android:id="@+id/linearLayout3"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:id="@+id/linearLayout2"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout android:id="@+id/optionslayout"
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:layout_width="match_parent" android:gravity="bottom">
<Button android:id="@+id/prev" android:layout_width="100dip" android:text="Previous" android:layout_height="wrap_content"></Button>
<Button android:id="@+id/next" android:layout_marginLeft="120dip" android:layout_width="100dip" android:text="Next" android:layout_height="wrap_content"> </Button>
</LinearLayout>
</LinearLayout>
</LinearLayout>
you can insert a
<View android:layout_height="0dp" android:layout_width="0dp" android:layout_weight="1"/>
right before your buttons.
Or use a relative layout with alignParentBottom="true"
You need a RelativeLayout instead of a LinearLayout as parent; then simply drag the buttons in the layout-GUI to the bottom and they should stick there. When i am at home i am able to post "real" example code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout …>
<!-- your posted code -->
Dragging the button's layout parent to the bottom will produce:
alignParentBottom="true"
精彩评论