OGeek|极客世界-中国程序员成长平台

标题: android - 如何使应用程序的背景图像重复 [打印本页]

作者: 菜鸟教程小白    时间: 2022-8-1 01:19
标题: android - 如何使应用程序的背景图像重复

我在我的应用程序中设置了背景图像,但背景图像很小,我希望它重复并填满整个屏幕。我应该怎么办?

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    androidrientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/bg"
    android:tileMode="repeat">



Best Answer-推荐答案


好的,这就是我的应用程序中的内容。它包括防止ListView 的黑客攻击。 s 在滚动时变黑。

可绘制/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" />

值/样式.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">
//

关于android - 如何使应用程序的背景图像重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2706913/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) Powered by Discuz! X3.4