开发者

Android - Custom dialog boxes layout problem

开发者 https://www.devze.com 2023-02-09 17:47 出处:网络
I have a custom dialog box displaying some text and a image underneath. The text is made up of a few lines and despite messing around with all the XML layout stuff millions of times, the image at the

I have a custom dialog box displaying some text and a image underneath.

The text is made up of a few lines and despite messing around with all the XML layout stuff millions of times, the image at the bottom is always overlapping half/some of the text. How can I tweak it so it appears underneath and after the text has finished?

<ImageView android:id="@+id/image"
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content"
       android:layout_centerHorizontal="true" 
          />

<ScrollView android:id="@+id/ScrollView01"
        android:layout_width="wrap_content" 
                android:layout_below="@+id/image"
        android:layout_height="200px">          

    <TextView  android:id="@+id/text"
           android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:textColor="#FFF"
             />

</ScrollView>     

<ImageView android:id="@+id/image2"
           android:layout_height="wrap_content"
           android:layout_width="wrap_content" 
           android:layout_centerHorizontal="true"
           android1:layout_alignParentBottom="true"/>

Items开发者_C百科 are set inside a RelativeLayout setting.


If you wrap your TextView and ImageView inside a RelativeLayout you can set the ImageView to display below the TextView.

<ImageView android:id="@+id/image2"
   android:layout_height="wrap_content"
   android:layout_width="wrap_content" 
   android:layout_centerHorizontal="true"
   android:layout_alignParentBottom="true"
   android:layout_below="@+id/ScrollView01"/>

EDIT: I saw that you had set android1:layout_alignParentBottom="true", is it a typo with the android1 and not android? Shouldn't it be android:layout_alignParentBottom="true"?

0

精彩评论

暂无评论...
验证码 换一张
取 消