0
我想組織這樣的相對佈局(黑色:imageView,紅色:ImageView,綠色:textView)。Android組織RelativeLayout
而Android似乎處理的黑色ImageView的像一個樣方,而不是一個矩形。
這裏的XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_vertical_margin">
<RelativeLayout
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/iv_cd_default"
android:src="@drawable/blackImage"
android:scaleType="centerInside"/>
<ImageView
android:id="@+id/iv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/iv_cd_default"
android:src="@drawable/redImage"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/iv1"
android:layout_alignEnd="@+id/iv1" />
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="some text here"
android:layout_alignBottom="@+id/iv1"
android:layout_alignRight="@+id/iv1"
android:layout_alignEnd="@+id/iv1"/>
</RelativeLayout>
....
框架佈局不會改變任何東西,黑色圖像仍然有這個空間的上方和下方 – lis