У меня есть RelativeLayout внутри LinearLayout, который я использую для отображения некоторых данных:
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:ellipsize="end"
android:maxLines="1"
android:textSize="16dp"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:singleLine="true" />
<ImageView
android:id="@+id/uhr"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="left"
android:layout_marginLeft="2dp"
android:layout_toRightOf="@id/time"
android:src="@drawable/event_clock" />
</RelativeLayout>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:autoLink="web|email"
android:textSize="14dp" />
</LinearLayout>
Проблема в том, что я хочу, чтобы мой ImageView был слева, а TextView рядом с ним. Однако, если я изменю android:layout_toRightOf="@id/time"
на android:layout_toLeftOf="@id/time"
, он покажет только TextView, но ImageView исчезнет.