Android之背景圖片設置為重復而不是默認的拉伸


創建重復的背景圖片

在drawable目錄下創建一個repeat_bg.xml:  src是引用圖片的名稱

1 <?xml version="1.0" encoding="utf-8"?>
2 <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
3     android:src="@drawable/bg"
4     android:tileMode="repeat" />

然后在布局的xml文件中可以這樣引用:
1 <LinearLayout android:layout_width="fill_parent"
2     android:layout_height="fill_parent"
3     android:background="@drawable/repeat_bg">
4 </LinearLayout>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM