Android 如何设置/缩小纵向中的表格行大小?
如何设置纵向表格的行宽和大小?我更喜欢它的景观。我有没有办法缩小纵向的“组件”表,并增加“标记”、“记过”和“注释”的大小? 我试着调整Android 如何设置/缩小纵向中的表格行大小?,android,android-layout,android-tablelayout,tablerow,Android,Android Layout,Android Tablelayout,Tablerow,如何设置纵向表格的行宽和大小?我更喜欢它的景观。我有没有办法缩小纵向的“组件”表,并增加“标记”、“记过”和“注释”的大小? 我试着调整布局的权重,布局的宽度和布局的大小,但不知怎么的,我再也看不到表头了 Lanscape视图 纵向视图 我想在肖像画中实现的目标 FragmentA.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:/
布局的权重
,布局的宽度
和布局的大小
,但不知怎么的,我再也看不到表头了
Lanscape视图
纵向视图
我想在肖像画中实现的目标
FragmentA.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="layout.fragmentA">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:background="@color/btn_textcolor"
android:orientation="vertical">
<TextView
android:id="@+id/cur_marks"
style="@style/marks"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right"
android:text="Markah: / 18"/>
</LinearLayout>
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="90dp"
android:shrinkColumns="*"
android:stretchColumns="*">
<!--Table header-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/th_component"
style="@style/table_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Component"/>
<TextView
android:id="@+id/th_marks"
style="@style/table_header"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Marks"/>
<TextView
android:id="@+id/th_demerits"
style="@style/table_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tableH_demerit"/>
<TextView
android:id="@+id/th_notes"
style="@style/table_header"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Notes"/>
</TableRow>
<!--Component A1-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<TextView
android:id="@+id/tv_cA1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="@dimen/text_padding"
android:text="@string/cB1"/>
<TextView
android:id="@+id/tv_mA1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/_12"
android:layout_weight="1"
android:gravity="center"/>
<CheckBox
android:id="@+id/checkBox_a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="visible"/>
<Button
android:id="@+id/btn_a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/catatan"/>
</TableRow>
</TableLayout>
<resources>
<string name="app_name">hellowWorld</string>
<string name="title_case_detail">Case Detail</string>
<string name="cB1">Kawalan suhu dan tempat mempamerkan makanan yang sesuai mengikut keadaan
dan jenis makanan: \n
- Suhu makanan panas: > 60 °C \n
- Suhu makanan dingin: 1 °C hingga 4 °C \n
- Suhu makanan sejuk beku: <= -18 °C
</string>
Strings.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="layout.fragmentA">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:background="@color/btn_textcolor"
android:orientation="vertical">
<TextView
android:id="@+id/cur_marks"
style="@style/marks"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right"
android:text="Markah: / 18"/>
</LinearLayout>
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="90dp"
android:shrinkColumns="*"
android:stretchColumns="*">
<!--Table header-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/th_component"
style="@style/table_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Component"/>
<TextView
android:id="@+id/th_marks"
style="@style/table_header"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Marks"/>
<TextView
android:id="@+id/th_demerits"
style="@style/table_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tableH_demerit"/>
<TextView
android:id="@+id/th_notes"
style="@style/table_header"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Notes"/>
</TableRow>
<!--Component A1-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<TextView
android:id="@+id/tv_cA1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="@dimen/text_padding"
android:text="@string/cB1"/>
<TextView
android:id="@+id/tv_mA1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/_12"
android:layout_weight="1"
android:gravity="center"/>
<CheckBox
android:id="@+id/checkBox_a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="visible"/>
<Button
android:id="@+id/btn_a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/catatan"/>
</TableRow>
</TableLayout>
<resources>
<string name="app_name">hellowWorld</string>
<string name="title_case_detail">Case Detail</string>
<string name="cB1">Kawalan suhu dan tempat mempamerkan makanan yang sesuai mengikut keadaan
dan jenis makanan: \n
- Suhu makanan panas: > 60 °C \n
- Suhu makanan dingin: 1 °C hingga 4 °C \n
- Suhu makanan sejuk beku: <= -18 °C
</string>
地狱世界
案例详情
这是一个可持续发展的过程
丹·杰尼斯·马卡南:\n
-Suhu makanan panas:>60°C\n
-Suhu makanan dingin:1°C hingga 4°C\n
-Suhu makanan sejuk beku:如果你给TableRow一个重量总和,并将重量平均分配给孩子,效果会很好
注意:对于子项,我们应该给出android:layout\u width=“0dp”
试试这个
谢谢!!使用weightSum
和设置layout\u width=“0dp”
确实解决了我的问题。