【问题标题】:Do all widgets in an Android layout file require layout_width and layout_height?Android 布局文件中的所有小部件都需要 layout_width 和 layout_height 吗?
【发布时间】:2010-03-30 19:03:16
【问题描述】:

我有一个由 LinearLayouts 组成的 ListView。每个内部都有一个 ImageView、TextView 和另一个水平布局的 ImageView:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >
            <ImageButton
                android:id="@+id/thumbnail"
                android:background="@color/white"
                android:paddingTop="10dip"
                android:paddingLeft="8dip"
                android:paddingBottom="10dip"
                />
            <TextView
                android:id="@+id/title"
                android:background="@color/white"
                android:textColor="@color/bntext"
                android:paddingTop="10dip"
                android:paddingLeft="8dip"
                />
            <ImageButton
                android:src="@drawable/green_arrow_small"
                android:background="@color/white"
                />
</LinearLayout>

【问题讨论】:

    标签: xml android layout


    【解决方案1】:

    是的。这应该会崩溃。

    【讨论】:

      猜你喜欢
      • 2015-04-07
      • 1970-01-01
      • 2016-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-17
      • 1970-01-01
      相关资源
      最近更新 更多