Я создаю пользовательские ActionBar
и у меня есть RelativeLayut
с двумя изображениями и текстом. Я хочу, чтобы второй ImageView
был зафиксирован справа, но я не могу этого сделать. Он сдвигается в зависимости от разрешения экрана. Как я могу решить эту проблему?Как исправить изображение справа?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:src="@drawable/ic_launcher" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="13dp"
android:id="@+id/layout_text"
android:layout_toRightOf="@id/icon"
android:orientation="vertical"
>
<TextView
android:id="@+id/actionbar_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="mAPP"
android:textSize="@dimen/actionbar_title_text_size"
android:textColor="#ffffff" />
</LinearLayout>
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:layout_toRightOf="@id/layout_text"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_alignParentRight="true"
android:src="@drawable/ic_image" />
</RelativeLayout>
Какой 'ImageView'? Один с id 'image' или' icon'? Также, пожалуйста, пройдите через некоторый учебник о 'RelativeLayout'. Кажется, у вас есть путаница. – Sufian
С id 'image'. –