【发布时间】:2012-05-23 15:53:41
【问题描述】:
我已经为此工作了好几个小时,但无法解决。 我想在一个 XML 文件中合并 2 个图像 - 所以这将是我的形状的基本 xml 文件。 我希望这个形状包括一个作为框架的 png 和一个作为框架内的图片的 png。那张图片会动态变化。
我尝试使用标签来构建我的形状,但是当我将它包含到我的主 xml 文件中时它失败了,因为我只能以根用户身份使用合并。 尝试做同样的事情,但仍然没有得到我想要的......
我该怎么做才能合并这两个 png,并能够在框架 png 内设置内部 png 位置??
编辑: 一些代码:
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/userprofilepicture"
android:scaleType="fitXY"
android:contentDescription="@string/SmallLogo" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="@string/SmallLogo"
android:scaleType="fitXY"
android:padding="30dp"
android:src="@drawable/questionmark" />
</FrameLayout>
这是我的框架和内部图片 xml 源.. 在图形布局中查看它时,它看起来不错。 当将它包含在我的主 xml 文件中时,由于某种原因它会翻转图像...... ???
这是我的主要 xml 的一部分:
<TableRow>
<ImageView
android:layout_gravity="center_vertical"
android:layout_marginTop="2.5dp"
android:contentDescription="@string/SmallLogo"
android:src="@drawable/logosmall" />
<ImageView
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginTop="2.5dp"
android:contentDescription="@string/slogen"
android:src="@drawable/slogen" />
<include layout="@drawable/userprofilepicture"
android:layout_width="30dp"
android:layout_height="30dp"/>
</TableRow>
【问题讨论】: