1

画像が常にレイアウトの右側にあるリストを作成しようとしています。同時に、画像がない場合は、件名のテキストでレイアウト全体を埋めたいと思います。

これは、画像が画像
で非表示の場合に達成したいことです
ここに画像の説明を入力

ここに画像の説明を入力

現在の出力:
テキストの先頭にある画像。
ここに画像の説明を入力

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:padding="6dip" android:layout_height="?android:attr/listPreferredItemHeight">
    <TextView
        android:id="@+id/subject"        
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true"
        android:text="Apple Orange Apple Orange Apple Orange Apple Orange Apple Orange Apple Orange"/>
    <TextView
        android:id="@+id/cdate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"       
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true" 
        android:textColor="#8000FF"       
        android:text="Date" />
    <ImageView  
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"      
        android:layout_alignParentRight="true" 
        android:layout_alignRight="@id/subject"
        android:src="@drawable/icon" />
</RelativeLayout>
4

2 に答える 2

3

これを試してください...乾杯:)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:padding="6dip" android:layout_height="?android:attr/listPreferredItemHeight">

<ImageView
    android:id="@+id/icon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true" 
    android:src="@drawable/icon" />

<TextView
    android:id="@+id/subject"        
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"    
    android:text="Apple Orange Apple Orange Apple Orange Apple Orange Apple Orange Apple Orange"
    android:layout_toLeftOf="@id/icon"/>
<TextView
    android:id="@+id/cdate"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"       
    android:layout_alignParentLeft="true"
    android:layout_alignParentBottom="true" 
    android:textColor="#8000FF"       
    android:text="Date" />

于 2013-04-05T02:04:34.913 に答える
1

あなたはこのようにする必要があります:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:padding="6dip" >

    <ImageView
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:src="@drawable/mark_ok" />

    <LinearLayout
        android:id="@+id/leftblock"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/subject"
        android:layout_alignTop="@+id/subject"
        android:layout_toLeftOf="@+id/icon"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/subject"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Apple Orange Apple Orange Apple Orange Apple Orange Apple Orange Apple Orange" />

        <TextView
            android:id="@+id/cdate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Date"
            android:textColor="#8000FF" />
    </LinearLayout>

</RelativeLayout>
于 2013-04-05T02:05:46.180 に答える