【问题标题】:Android tablelayout design with image object带有图像对象的 Android 表格布局设计
【发布时间】:2011-07-29 09:43:57
【问题描述】:

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

但我没有办法设计这样的布局。

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

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

【问题讨论】:

    标签: android android-layout android-emulator android-widget tablelayout


    【解决方案1】:

    表格布局解决方案:

    <?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>
    

    玩得开心! :)

    【讨论】:

      猜你喜欢
      • 2018-03-26
      • 2012-02-12
      • 1970-01-01
      • 1970-01-01
      • 2014-06-02
      • 2011-03-05
      • 1970-01-01
      • 2012-03-05
      • 1970-01-01
      相关资源
      最近更新 更多