4
所以我有這個位圖我想用作視圖的背景,但是位圖有時可能比視圖大。位圖剪輯?
讓我們說我的位圖是500×500像素 和我的看法是200x200px
當我設置位圖作爲背景的視圖,該視圖獲取的拉伸位圖(500×500)的大小...
我嘗試設置重力clip_horizontal | clip_vertical但沒有幫助...
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/old_wall"
android:tileMode="repeat"
android:gravity="top|left|clip_horizontal|clip_vertical" />
我怎麼能得到位圖會被切去,而不是視圖被拉伸位圖的大小?
'gravity'被忽略。請參閱[位圖可繪製資源](http://developer.android.com/guide/topics/resources/drawable-resource.html#Bmapmap)。 –