【发布时间】:2021-06-25 10:02:10
【问题描述】:
我想要的是当文本很长时,表格形状不应该扭曲。如我添加的图像所示,第一个文本很长,其他单元格和文本已损坏。我想解决这个问题。
<TableLayout
android:id="@+id/table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="30dp"
android:layout_marginHorizontal="10dp"
android:background="#f1f1f1"
>
<TableRow>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:maxLines="1"
android:text="fospfdmglfdmglğpkdsağgorjgdfglkdfdsfsdfsdfg"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email"
android:textStyle="bold"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tel"
android:textStyle="bold"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
</HorizontalScrollView>
</TableRow>
<TableRow>
【问题讨论】:
-
你希望它表现如何?
-
如果文本很长,文本可能会缩小或向下滑动而不破坏单元格。只要不打乱单元格的顺序,整张图片都会因为1个单元格而失真
标签: java android android-studio android-layout text-size