У меня есть список страховых компаний, использующих listView
, и я пытаюсь выровнять свои стрелки справа. Я рассмотрел несколько примеров, но никто не работает. Мой код выглядит залежиКак выровнять изображение ImageView
myList.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#26BFDA">
<ImageView
android:id="@+id/icon"
android:layout_width="60dp"
android:layout_height="60dp"
android:padding="5dp" />
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:id="@+id/item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:padding="2dp"
android:textColor="#FFFFFF"
/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_marginLeft="10dp"/>
</LinearLayout>
<ImageView
android:layout_width="20dp"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:layout_weight="0.1"
android:layout_alignParentRight="true"
android:src="@drawable/nextarrow"/>
</LinearLayout>
Главная активность
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
>
</ListView>
На рисунке показано, как она в данный момент выглядит.
Это сработало для меня. Отмечено как правильный ответ. благодаря –