【问题标题】:Android - Custom dialog boxes layout problemAndroid - 自定义对话框布局问题
【发布时间】:2011-02-09 11:57:47
【问题描述】:

我有一个自定义对话框,在下面显示一些文本和图像。

文本由几行组成,尽管将所有 XML 布局的东西弄乱了数百万次,但底部的图像总是与文本的一半/部分重叠。如何调整它以使其在文本完成后出现在下方?

<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"/>

项目在 RelativeLayout 设置中设置。

【问题讨论】:

  • 如果你添加你的xml布局会更容易帮助你。

标签: java android xml layout dialog


【解决方案1】:

如果将 TextView 和 ImageView 包装在 RelativeLayout 中,则可以将 ImageView 设置为显示在 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"/>

编辑: 我看到你设置了 android1:layout_alignParentBottom="true",是不是 android1 而不是 android 的错字?不应该是android:layout_alignParentBottom="true"吗?

【讨论】:

  • 谢谢,在底部添加那行就可以了,是的,当我将代码复制到文本窗口时,“1”是我最后的错字。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-09-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-28
  • 1970-01-01
相关资源
最近更新 更多