0
我有一個空調圖像,現在我想在右上角顯示它的品牌名稱(另一圖像),以及當前溫度(圖像也在中間)。有沒有一種方便的方法來實現這一點?Android:如何在另一個圖像視圖中嵌入圖像?
我有一個空調圖像,現在我想在右上角顯示它的品牌名稱(另一圖像),以及當前溫度(圖像也在中間)。有沒有一種方便的方法來實現這一點?Android:如何在另一個圖像視圖中嵌入圖像?
您可以通過使用RelativeLayout
來實現此目的,它允許您覆蓋彼此的視圖。你可以閱讀更多關於RelativeLayouts here。
這是你如何可以使用RelativeLayout的,雖然你將不得不調整它爲你,你沒有張貼任何代碼的一個例子:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/image"
android:layout_width="30dip"
android:layout_height="30dip"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/image2"
android:layout_width="30dip"
android:layout_height="30dip"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/imagef"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:background="@drawable/ph_bg" />
</RelativeLayout>
由於它的工作原理。 – Zippon