Android 表格布局设计与图像对象

发布于 2024-11-27 07:51:13 字数 316 浏览 4 评论 0原文

我想设计一个表格布局,其中包含 2 个垂直文本视图和一个位于这 2 个文本视图正前方的图像视图,如所附图像所示。

但我没有任何方法来设计这样的布局。

请帮助我如何使用表格布局或任何其他布局来设计这个(参见附图中显示的设计)?谢谢。

示例 http://www.freeimagehosting.net/1441f

I want to design a table layout that contains 2 vertical textviews and an imageview at exactly front on this 2 textviews as shown in the image attached.

But I am not getting any way to design such a layout.

Please help how can I design this (see design shown in attached image) using table layout or any other layout? Thanks.

example
http://www.freeimagehosting.net/1441f

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尹雨沫 2024-12-04 07:51:13

表格布局的解决方案:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TableLayout
        android:layout_height="wrap_content"
        android:id="@+id/tableLayout1"
        android:layout_width="match_parent">
        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="10dip">
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:orientation="vertical">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Grilled Fish with Tangerine and..." />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dip"
                    android:text="Quantity: 5" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_weight="3">
            <ImageView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:src="@drawable/icon"
                android:layout_gravity="right">
            </ImageView>
            </LinearLayout>
        </TableRow>
        <View
            android:layout_height="1dip"
            android:background="#FFFFFF" />
    </TableLayout>

</LinearLayout>

玩得开心! :)

Solution with table layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TableLayout
        android:layout_height="wrap_content"
        android:id="@+id/tableLayout1"
        android:layout_width="match_parent">
        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="10dip">
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:orientation="vertical">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Grilled Fish with Tangerine and..." />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dip"
                    android:text="Quantity: 5" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_weight="3">
            <ImageView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:src="@drawable/icon"
                android:layout_gravity="right">
            </ImageView>
            </LinearLayout>
        </TableRow>
        <View
            android:layout_height="1dip"
            android:background="#FFFFFF" />
    </TableLayout>

</LinearLayout>

Have fun! :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文