0

スクロールビューを含むこの相対レイアウトがあります。しかし、スクロールビューにさらにテキストが含まれている場合、下部のテキストは表示されず、ボタンの後ろに表示されます。どうすればこれを修正できますか?

これが私がしたことです:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#00AEEC"
    android:orientation="vertical"
    android:weightSum="100" >

    <RelativeLayout
        android:id="@+id/details_header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="clip_horizontal"
        android:background="#00AEEC"
        android:padding="20dp" >



        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:src="@drawable/onlywithalcohol_heading_page2" />

    </RelativeLayout>

 <RelativeLayout
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_below="@+id/details_header"
     android:layout_centerHorizontal="true"
     android:layout_margin="20dp" >

     <TextView
         android:id="@+id/details_country"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentTop="true"
         android:layout_centerHorizontal="true"
         android:layout_marginBottom="20dp"
         android:text="USA"
         android:textAlignment="center"
         android:textAppearance="?android:attr/textAppearanceMedium" />

     <TextView
         android:id="@+id/details_title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@id/details_country"
         android:layout_centerHorizontal="true"
         android:layout_marginBottom="20dp"
         android:gravity="center_horizontal"
         android:text="Fastest Time To Drink A Pint Of Soda Water, Consume A Bowl Of Macaroni And Cheese With Chopsticks, Eat And Read A Fortune Cookie And Take A Shot Of Peach Schnapps "
         android:textAlignment="center"
         android:textAppearance="?android:attr/textAppearanceMedium"
         android:textColor="#FFFF00" />

     <ScrollView
         android:layout_width="fill_parent"
         android:layout_height="200dp"
         android:layout_alignParentBottom="true"
         android:layout_below="@id/details_title"
         android:layout_centerHorizontal="true" >

         <TextView
             android:id="@+id/details_description"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginBottom="20dp"
             android:gravity="center_horizontal"
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
             android:text="Sam Birdsong removed a cork from an empty bottle of wine using just a napkin in two minutes, 55.47 seconds.He stipulated beforehand that he had to begin with an unopened bottle, uncork it and pour out the wine, then shove the cork back inside the bottle and pull it out with a cloth napkin"
             android:textAlignment="center"
             android:textAppearance="?android:attr/textAppearanceMedium" />
     </ScrollView>
 </RelativeLayout>

 <LinearLayout
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_alignParentBottom="true"
     android:layout_centerHorizontal="true"
     android:layout_margin="10dp"
     android:background="#00AEEC"
     android:orientation="vertical" >

     <Button
         android:id="@+id/details_back_btn"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:padding="10dp"
         android:text="@string/back_btn"
         android:textSize="18sp"
         android:textStyle="bold" />
 </LinearLayout>

</RelativeLayout>
4

2 に答える 2

1

ボタンを含むLinearLayoutにIDを追加します。次に例を示します。

android:id="@+id/bottomLayout"

scrollViewを含むRelativeLayoutでこれを使用します。

android:layout_above="@+id/bottomLayout"

20dpの下マージンがあることに注意してください。それが望ましくない場合は、android:layout_marginLeft、android:layout_marginRight、およびandroid:layout_marginTopを使用して、他のすべての場所に20dpマージンがあることを確認できます。

于 2013-02-19T15:12:50.130 に答える
0

レイアウトをLinearLayoutに変更すると、うまくいくはずです。使用する必要があるかもしれません

android:gravity="bottom"

画面の一番下にボタンを揃えます

そしてあなたは使用する必要があるかもしれません

android:layout_weight=""

必要に応じて。

LinearLayoutこれは、垂直方向の中に配置できるブロックです:

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:src="@drawable/ic_launcher" />

<TextView
    android:id="@+id/details_country"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="20dp"
    android:text="USA"
    android:textAlignment="center"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
    android:id="@+id/details_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/details_country"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="20dp"
    android:gravity="center_horizontal"
    android:text="Fastest Time To Drink A Pint Of Soda Water, Consume A Bowl Of Macaroni And Cheese With Chopsticks, Eat And Read A Fortune Cookie And Take A Shot Of Peach Schnapps "
    android:textAlignment="center"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#FFFF00" />

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="200dp"
    android:layout_alignParentBottom="true"
    android:layout_below="@id/details_title"
    android:layout_centerHorizontal="true" >

    <TextView
        android:id="@+id/details_description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:gravity="center_horizontal"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:text="Sam Birdsong removed a cork from an empty bottle of wine using just a napkin in two minutes, 55.47 seconds.He stipulated beforehand that he had to begin with an unopened bottle, uncork it and pour out the wine, then shove the cork back inside the bottle and pull it out with a cloth napkin , and this wilk take for ever and ever out the wine, then shove the cork back inside the bottle and pull it out with a cloth napkin , and this wilk take for ever and ever out the wine, then shove the cork back inside the bottle and pull it out with a cloth napkin , and this wilk take for ever and ever out the wine, then shove the cork back inside the bottle and pull it out with a cloth napkin , and this wilk take for ever and ever "
        android:textAlignment="center"
        android:textAppearance="?android:attr/textAppearanceMedium" />
</ScrollView>

<Button
    android:id="@+id/details_back_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_weight=""
    android:gravity="bottom"
    android:padding="10dp"
    android:text="back"
    android:textSize="18sp"
    android:textStyle="bold" />
于 2013-02-19T15:12:26.817 に答える