我已经在我的应用程序中设置了背景图像,但背景图像很小,我希望它是重复的,并填充整个屏幕。我该怎么办?
<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">
好吧,这是我在我的应用程序中得到的。它包括一个黑客,以防止ListViews在滚动时变黑。
可拉的/ 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" />
值/ 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">
//
好吧,这是我在我的应用程序中得到的。它包括一个黑客,以防止ListViews在滚动时变黑。
可拉的/ 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" />
值/ 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">
//