首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否仅在Galaxy Nexus上显示背景图像?

是否仅在Galaxy Nexus上显示背景图像?
EN

Stack Overflow用户
提问于 2012-05-31 23:08:29
回答 1查看 2.1K关注 0票数 5

这里有一个非常奇怪的问题,背景图片资源在除Galaxy Nexus (或者我目前为止发现的)之外的所有手机上都可以正常显示。

在多个不同的手机中找到下面的应用程序图库,但请注意,在第六张图片中,nexus没有背景?

我已经设置了对所有密度和大+ XL屏幕尺寸的支持,我将发布一个布局的XML,但是它跨越所有布局,无论它是否有任何控件/线性布局或其他任何东西。

图片来源:http://goo.gl/59c8C

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent" android:background="@drawable/app_bg">

     <ScrollView
         android:id="@+id/scrollView12"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent" android:layout_alignParentBottom="true" android:fillViewport="true">

         <RelativeLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent" >

                 <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical" android:layout_alignParentBottom="true">


             <com.quickcontact.CustomTextView
                 android:id="@+id/CustomTextView01"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginTop="10dp"
                 android:gravity="center"
                 android:text="Tap the buttons below to create your contact profiles. You will be able to assign contact details to each of your profiles and share them with others."
                 android:textColor="#3f3f3f"
                 android:textSize="15sp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_gravity="center_horizontal"/>

             <com.quickcontact.CustomTextView
                 android:id="@+id/receiveHeadertxt"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginTop="20dp"
                 android:gravity="center"
                 android:text="-- Create Profile --"
                 android:textColor="#3f3f3f"
                 android:textSize="15sp" android:layout_gravity="center_horizontal"/>

             <com.quickcontact.CustomButton
                 android:id="@+id/butPersonal"
                 android:layout_width="match_parent"
                 android:layout_height="78dp"
                 android:background="@drawable/standard_button"
                 android:padding="1dp"
                 android:text="Personal"
                 android:textColor="#3f3f3f"
                 android:textSize="16sp" />

             <com.quickcontact.CustomButton
                 android:id="@+id/butSocial"
                 android:layout_width="match_parent"
                 android:layout_height="78dp"
                 android:layout_marginTop="5dp"
                 android:background="@drawable/standard_button"
                 android:padding="1dp"
                 android:text="Social"
                 android:textColor="#3f3f3f"
                 android:textSize="16sp" />

             <com.quickcontact.CustomButton
                 android:id="@+id/butBusiness"
                 android:layout_width="match_parent"
                 android:layout_height="78dp"
                 android:layout_marginTop="5dp"
                 android:background="@drawable/standard_button"
                 android:padding="1dp"
                 android:text="Business"
                 android:textColor="#3f3f3f"
                 android:textSize="16sp" android:layout_marginBottom="20dp"/>

             <com.quickcontact.CustomButton
                 android:id="@+id/butNext"
                 android:layout_width="fill_parent"
                 android:layout_height="58dp"
                 android:background="@drawable/blue_button"
                 android:gravity="center_vertical|center_horizontal"
                 android:paddingBottom="1dp"
                 android:text="NEXT"
                 android:textColor="#3f3f3f"
                 android:textSize="16sp" />

         </LinearLayout>

         </RelativeLayout>

     </ScrollView>

 </RelativeLayout>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-05-31 23:30:39

Galaxy Nexus是xhdpi设备。背景图片是否位于/res/drawable-xhdpi/目录中?

另一种选择是,如果您的背景只是一个渐变,那么您可以用xml编写一个渐变脚本,并将其放在/res/layout/app_bg.xml中。

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

<item>
    <shape>
        <gradient
            android:startColor="@color/green2"
            android:endColor="@color/green1"
            android:gradientRadius="555"
            android:type="radial" />
    </shape>
</item>
</selector>

然后将你的背景引用为android:background="@layout/app_bg"

我的偏好是创建一个单一的布局样式xml,在整个应用程序中保持一致的样式,然后将它们包含在所有其他xml布局中。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10836268

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档