Android 桌面视图问题
以下 Android 布局是我的 listactivity 的自定义行。表行中的第二个文本视图不会像我想要的那样拉伸以适应列。请注意,只有一行表格,因为为了简洁起见,我删除了其他行。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="6dip">
<ImageView
android:id="@+id/DocTypeIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"
android:layout_gravity="center_vertical" />
<TableLayout
android:id="@+id/tableLayout1"
android:layout_toRightOf="@id/DocTypeIcon"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:stretchColumns="1">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pages"
android:textStyle="bold"
android:layout_marginRight="10dp" />
<TextView
android:id="@+id/DynamicTextHere"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
</TableRow>
<!-- Other rows stripped for brevity -->
</TableLayout>
</RelativeLayout>
当我输入stretchColumns =“1”时,我在屏幕上只看到了一些伪影。 当stretchColumns不存在时,布局仅变为固定宽度。我相信这可能是relativelayout把我搞砸了。然而,这比我想要的还要剧烈。我可以做一些小事情来使这一行适合我的屏幕(纵向和横向)吗?
the following Android layout is a custom row for my listactivity. The second textview in the tablerow does not stretch to fit the column like I want it to. Note that there is only one tablerow because I took the others out for brevity.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="6dip">
<ImageView
android:id="@+id/DocTypeIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"
android:layout_gravity="center_vertical" />
<TableLayout
android:id="@+id/tableLayout1"
android:layout_toRightOf="@id/DocTypeIcon"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:stretchColumns="1">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pages"
android:textStyle="bold"
android:layout_marginRight="10dp" />
<TextView
android:id="@+id/DynamicTextHere"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
</TableRow>
<!-- Other rows stripped for brevity -->
</TableLayout>
</RelativeLayout>
When I put stretchColumns="1" in, I see nothing but a couple of artifacts on the screen.
When stretchColumns is not there the layout only goes to a fixed width. I believe it might be the RelativeLayout screwing me up. However, that is more of a drastic change than I want. Can I do something small to make this row fit to my screen (both portrait and landscape)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以尝试: android:stretchColumns="*"
Can you try: android:stretchColumns="*"