在xml中创建具有特定格式的列?

时间:2012-07-04 13:22:43

标签: android android-layout

示例屏幕截图
enter image description here

如何使用任何布局创建此格式。

1 个答案:

答案 0 :(得分:2)

下面的布局将使imageview占用所需空间,并使Textview扩展并占用所有剩余空间。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal" > 
    <TextView 
        android:layout_width="0dp" 
        android:layout_height="wrap_content"
        android:layout_weight="1" 
        android:text="Welcome" /> 
    <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:src="@drawable/yourimagename" /> 
</LinearLayout>