【发布时间】:2015-08-13 17:28:56
【问题描述】:
我试图让表格行中的文本视图的文本出现在多行上,但由于某种原因它没有正确换行,我最终得到了这个(见截图)。我知道文本视图可以做到这一点,但我不知道是什么导致了这个问题的发生。有什么办法可以解决这个问题?
截图
列表项 XML
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow>
<ImageView
android:id="@+id/img"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
</TableLayout>
【问题讨论】:
-
给出一些正确的填充,为什么你没有为
<TableRow>设置属性? -
@Rustam Cool,但它不适用于平板电脑。检查适当的屏幕截图。
-
是横向模式吗?如果是这样,那么在 layout-land 文件夹中为横向创建单独的布局
标签: android xml textview android-tablelayout