gpt4 book ai didi

java - 如何在android中制作一个表格有一张图片和2个 TextView ?

转载 作者:行者123 更新时间:2023-12-01 14:09:12 25 4
gpt4 key购买 nike

这是我的第一个问题,如果我问错了,请指导我。我想用一个表格来显示我的游戏中包含图片、标题和简短描述的角色数量。单击角色后,用户将转移到另一个 View ,在那里他可以看到有关该角色的更多详细信息。

最佳答案

假设您的布局可能在 Table 的第一行包含 TextView(Title) 以及 ImageView(Your Picture)TextView (简要说明)。您可以根据 TableRow 的要求使用 android:weightSumandroid:layout_weight

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">

<TableLayout
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:weightSum="3"
>

<TableRow
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_weight="1"
>
<TextView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_span="2"
android:text="Title"
/>
</TableRow>

<TableRow
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_weight="2"
>
<ImageView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:src="drawable/...png"
/>
<TextView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:text="Brief Description"
/>
</TableRow>
</TableLayout>
</LinearLayout>

关于java - 如何在android中制作一个表格有一张图片和2个 TextView ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18670163/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com