【发布时间】:2017-03-21 18:18:38
【问题描述】:
目前我正在开发一些包含list 的android 应用程序。
我在移动(手机)设备中制作了一个。
我想在平板电脑(7“-10”)显示器中制作responsive。因此header 和column 看起来与移动显示中的相同。
这是 5" 和 7" 显示器的区别:
这是我当前的 xml 代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:tag="reqtag"
>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:showDividers="beginning|end"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Date"
android:id="@+id/tvClaimDateReimbursementRequest"
android:layout_marginRight="50dp"
android:textSize="12dp"
android:width="100dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Type"
android:textSize="12dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:id="@+id/tvTypeRequestReimbursement"
android:width="80dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Amount"
android:textSize="10dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:width="100dp"
android:id="@+id/tvAmountReimbursementRequest" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Status"
android:textSize="12dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:id="@+id/tvStatusReimbursementRequest" />
</TableRow>
</TableLayout>
我在这里看到了文档https://developer.android.com/guide/practices/screens_support.html
但我还是不明白, 有没有最佳实践来做这样的事情?
谢谢
【问题讨论】:
-
更改线性布局的表格:我会添加一个父线性布局(垂直)和内部:线性布局(垂直),在这个线性布局下,recyclerview。为了让它反应灵敏,就像 Stas Melnychenko 所说的那样使用重力。删除边距,给更大的文本大小并使用strings.xml添加文本,:不要对文本进行硬编码,如果需要维护代码,它没有用。
标签: java android android-studio tablelayout