【发布时间】:2015-10-12 14:08:53
【问题描述】:
我有这样的线性布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
android:background="@drawable/bgapp" >
我现在需要的是设置背景图像ScaleType 值以便每次都填满屏幕的可能性,这是因为我要下载图像然后将其设置为背景但没有ScaleType 图像不会根据屏幕密度保持其纵横比。
我发现的是这个解决方案:
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bgapp"
android:scaleType="centerCrop"
android:gravity="bottom|left" />
但它没有按预期工作.. 有没有办法设置 LinearLayout scaleType 属性或者我需要更改我的布局?
【问题讨论】:
-
你不能在线性布局中使用 scaletype .. 你可以检查这个stackoverflow.com/a/16139059/931982
-
@pskink 你能解释一下如何使用它吗?
-
@pskink 我明天试试,我会告诉你的,谢谢:)
标签: android