我有这个代码:
<RelativeLayout
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_width="398px"
android:layout_marginTop="35px"
android:layout_alignParentRight="true" >
....
<ImageView
android:layout_width="373px"
android:layout_height="222px"
android:layout_marginTop="35px"
android:src="@drawable/hairfall_text"
android:layout_below="@+id/pr_title" />
</RelativeLayout>
它渲染此图像以在我的设备上显示为这样 (准确地说是 P7500 Galaxy Tab 10.1):
这是我的资源文件夹中的实际可绘制对象:
已经用谷歌搜索和穷尽相关信息,我已经将图像的像素格式调整为 ARGB_8888(32 位),还设置了 Activity 的窗口像素格式(getWindow().setFormat(PixelFormat.RGBA_8888);
)什么都不做。
我希望有人能对这件事有所了解。非常感谢。
最佳答案
- 首先,如果你能做到,而不是为高度和宽度做“Wrap_content”,例如 layout_height="wrap_content" 和 layout_width="wrap_content" 用于您的 ImageView。您也可以为您的 Parent RelativeLayout 执行相同的操作,但 fill_parent。
- 其次使用"dp"代替"px"。推荐。
LINK用于安卓测量。 如果可行,请尝试此操作。
关于android - 是什么导致此 PNG 渲染不佳?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9528764/