Я хочу, чтобы отображать кнопки внизу экрана, а кнопки находятся внутри linearLayout4, может кто-нибудь, пожалуйста, скажите мне об этом, сейчас я в отчаянии - PullRequest
0 голосов
/ 29 сентября 2011

Проблема с последним линейным макетом, содержащим кнопки, я хочу отобразить мой последний линейный макет, то есть id-linearlayout4, внизу экрана, чтобы мои кнопки располагались внизу ...

 <?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>

Ответы [ 2 ]

3 голосов
/ 29 сентября 2011

Вы можете вставить

<View android:layout_height="0dp" android:layout_width="0dp" android:layout_weight="1"/>

прямо перед вашими кнопками.

Или использовать относительную компоновку с alignParentBottom = "true"

0 голосов
/ 29 сентября 2011

Вам нужен RelativeLayout вместо LinearLayout в качестве родителя;затем просто перетащите кнопки в GUI-макете вниз, и они должны прилипнуть к ним.Когда я дома, я могу опубликовать «реальный» пример кода.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout …>
<!-- your posted code -->

Перетаскивание родительского макета кнопки вниз приведет к:

alignParentBottom="true"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...