android– 为什么RelativeLayour中的九个补丁图像会隐藏所有内部元素?

android– 为什么RelativeLayour中的九个补丁图像会隐藏所有内部元素?,第1张

概述当我将9.PNG图像设置为RelativeLayout的背景时,其中的所有元素都缩小到中间.这是XML和快照.<RelativeLayoutxmlns:android="http://schemas.android.com/apkes/android"android:layout_width="fill_parent"android:layout_height="fill_parent&q

当我将9.PNG图像设置为relativeLayout的背景时,其中的所有元素都缩小到中间.这是XML和快照.

<relativeLayout        xmlns:androID="http://schemas.androID.com/apk/res/androID"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent"        androID:background="@drawable/bg"        >    <TextVIEw            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:text="Just a simple white text which does not show up"            androID:textcolor="#ffffff"            /></relativeLayout>

如果我将背景更改为颜色或普通图像,我会得到文本.

androID:background="@drawable/bg2" //normal image

谁能解释为什么会这样?

解决方法:

你定义了9补丁的内容区域了吗?因为看起来内容区域是中间的小像素.

内容区域由九个补丁的底部和右侧定义.例如,您可以使其与补丁一样大.

总结

以上是内存溢出为你收集整理的android – 为什么RelativeLayour中的九个补丁图像会隐藏所有内部元素?全部内容,希望文章能够帮你解决android – 为什么RelativeLayour中的九个补丁图像会隐藏所有内部元素?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1109501.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存