안드로이드에서 배경 이미지를 반복해서 출력하고 싶어요
조회수 2729회
발생하는 문제 및 실행환경
제 안드로이드 앱에는 배경이미지가 있는데요. 배경이미지가 너무 작아서 이걸 반복해서 배경을 채우게하고싶거든요 어떻게하면 좋을까요??
에러메시지(있는 경우)
소스코드
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
android:tileMode="repeat">
1 답변
-
이건 제 앱의 예제인데요. 따라하시면 될것같아요.
drawable/app_background.xml:
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/actual_pattern_image" android:tileMode="repeat" />
values/styles.xml:
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="app_theme" parent="android:Theme"> <item name="android:windowBackground">@drawable/app_background</item> <item name="android:listViewStyle">@style/TransparentListView</item> <item name="android:expandableListViewStyle">@style/TransparentExpandableListView</item> </style> <style name="TransparentListView" parent="@android:style/Widget.ListView"> <item name="android:cacheColorHint">@android:color/transparent</item> </style> <style name="TransparentExpandableListView" parent="@android:style/Widget.ExpandableListView"> <item name="android:cacheColorHint">@android:color/transparent</item> </style> </resources>
AndroidManifest.xml:
<application android:theme="@style/app_theme">
댓글 입력