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