<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/file_icon"
style="@style/fileChooserIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/desc" />
<TextView
android:id="@+id/file_name"
style="@style/fileChooserName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
Run Code Online (Sandbox Code Playgroud)
错误:This tag and its children can be replaced by one <TextView/> and a compound drawable
我是Android新手,并不完全了解什么是错误.某种解决方案令人伤心,使其复合但却没有得到它.
使用TextView的setCompoundDrawable*()方法或使用将TextView和ImageView合并为一个android:drawableLeft.
例:
你来自
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:padding="5dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="My Compound Button" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_drawable" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
至
<TextView
android:layout_marginTop="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="My Compound Button"
android:drawableRight="@drawable/my_drawable"
android:padding="5dp" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2721 次 |
| 最近记录: |