【发布时间】:2014-08-13 11:42:08
【问题描述】:
我有这样的布局
<ListView>
andorid:layout_width="math_parent"
android:layout_height="math_parent"
android:orientation="vertical" >
<ListView>
andorid:layout_width="math_parent"
android:layout_height="wrap_content"
android:orientation="horisontal" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:textColor="@android:color/black"
android:layout_gravity="center_vertical"
android:text="bla bla"
android:textSize="13sp" />
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:background="@drawable/round_button"
android:layout_weight="1" />
</ListView>
.........
</ListView>
所以我的圆形按钮不是圆形的,导致子布局中高度小于父主布局中的像素数。我怎样才能得到圆形按钮? 谢谢
【问题讨论】:
-
如果你想在你的
ListView中有TextView和ImageView,那么你应该扩展另一个布局,在那个布局中你应该有TextView和ImageView。这不是这样做的方法。 -
什么是
round_button? XML?还是图片? -
我想你对
ListView的概念感到困惑。你想要达到的是listview with custom rows -
为列表中的项目创建具有自定义布局的自定义列表视图。就像@Aniruddha 说的那样。
-
感谢您的回答。我的意思是一个圆圈上的按钮。它是 png 图像(它不是必需的,所以它可以是带有选择器的 xml)。我不想对所有视图使用带 id 的 RelativeLayout,因为我有很多自定义子布局,而不是我应该使用 ListView
标签: android listview button rounding