我有一個ImageView對齊到TextView的右邊。當文本太長時,它會調整圖像大小...如何保持圖像的大小相同並將TextView強制爲新行?不能修復ImageView裏面的RelativeLayout
這裏是XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@color/md_white_1000"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:id="@+id/btn_container_1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@color/blue"
android:layout_weight=".50"
android:layout_marginRight="1dp">
<Button
android:id="@+id/btn_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:onClick="searchClicked"/>
<TextView
android:id="@+id/btn_text_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="@color/md_white_1000"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:text="BTN1" />
<ImageView
android:id="@+id/btn_image_1"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/btn_text_1"
android:layout_toRightOf="@id/btn_text_1"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:src="@drawable/draw" />
</RelativeLayout>
</LinearLayout>
在Textview標籤中嘗試android:ellipsize =「end」 – Onkar