我有一个Android应用程序,其中包含一个RelativeLayout
,其中包含TableLayout
。Android - Scale TableLayout至屏幕尺寸
在TableLayout
之内,有3个ImageView
s用于每个3 TableLayout
行。 (总共制作9个)
我遇到的问题是每行中最后的ImageView
部分被切断。
这是我目前的XML代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
tools:context=".Main">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:shrinkColumns="true"
android:id="@+id/TableLayout">
<TableRow
android:id="@+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/s1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"/>
<ImageView
android:id="@+id/s2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"/>
<ImageView
android:id="@+id/s3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"/>
</TableRow>
</TableLayout>
</RelativeLayout>
(行的其余部分是相同的)
我试图玩弄像fill_parent
和wrap_content
值,但我还没有任何成功了。
我想将TableLayout
缩放到屏幕大小,以便它在所有设备上都看起来不错,没有任何图像被切断。
提前感谢!
它是在右边还是下边?你可以添加一个截图吗? – RobinF
@RobinF正在剪切图像。我会尽力得到一个截图。 –
@RobinF我添加了一个截图,希望它有帮助。 –