将普通布局转换为xlarge布局android

时间:2012-08-02 14:11:05

标签: android android-layout

我在xml布局下使用正常布局进行渲染。 但是当我尝试在像华硕变换器(Honeycomb或Ice Cream Sandwich)这样的xlarge屏幕中运行时,Image Button的图像从drawable-mdpi资源文件夹中获取图像。甚至尝试更改大屏幕按钮的布局和更大的图像,但同样的mdpi图像呈现。

有人可以给我一些关于如何解决这个问题的指示。感谢。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@drawable/white"
android:fillViewport="true"
android:tileMode="repeat" >

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
     <LinearLayout
        android:layout_alignParentTop="true"
        android:layout_width="fill_parent" 
        android:layout_height="30dip"
        android:background="#000000"
        android:tileMode="repeat"
        android:weightSum="3">

     <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_weight="1">
    <TextView 
        android:text=""
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:textSize="18sp"
        android:textColor="#000000"/>
    </LinearLayout>
     <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_weight="1">
          <ImageView 
            android:src="@drawable/logo1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    </LinearLayout>
    <LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_weight="1">
        <ImageButton 
            android:id="@+id/buttonMainBackClosetheApp"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#000000"
            android:tileMode="repeat"/>
     </LinearLayout>

         </LinearLayout>   







<LinearLayout 
android:layout_marginTop="30dip"
android:layout_marginBottom="30dip"
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
android:weightSum="3" 
android:orientation="vertical">

<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_weight="1"
    android:weightSum="3" 
    android:orientation="horizontal"
    android:layout_marginTop="15px">

    <LinearLayout 
        android:id="@+id/linearLayoutBtnFindUs"
        android:layout_width="fill_parent"
        android:layout_weight="1" 
        android:orientation="vertical"
        android:gravity="center" 
        android:layout_height="fill_parent">

        <ImageButton 
            android:id="@+id/btnFindUs"
            android:src="@drawable/findus_icon"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:background="@drawable/white" />
        <TextView 
            android:text="Find Us" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#000000" />
    </LinearLayout>


    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_weight="1" 
        android:orientation="vertical"
        android:gravity="center" 
        android:layout_height="fill_parent">

        <ImageButton 
            android:id="@+id/btnCatalog"
            android:src="@drawable/catalog_icon"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:background="@drawable/white"/>
        <TextView 
            android:text="Catalog" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:textColor="#000000"/>
    </LinearLayout>

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_weight="1"
        android:orientation="vertical" 
        android:gravity="center">

        <ImageButton 
            android:id="@+id/btnMyContact"
            android:src="@drawable/mycontact_icon"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:background="@drawable/white"/>
        <TextView 
            android:text="My" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#000000"/>
        <TextView 
            android:text="Contacts" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#000000"/>
    </LinearLayout>
</LinearLayout>

<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_weight="1"
    android:weightSum="3" 
    android:orientation="horizontal">
    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_weight="1"
        android:orientation="vertical" 
        android:gravity="center">

        <ImageButton 
            android:id="@+id/btnPhoto"
            android:src="@drawable/photo_icon"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:background="@drawable/white"/>
        <TextView 
            android:text="Photo" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:textColor="#000000"/>
    </LinearLayout>

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_weight="1"
        android:orientation="vertical" 
        android:gravity="center">
        <ImageButton 
            android:src="@drawable/myaccount_icon"
            android:id="@+id/btnMyAccount"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:background="@drawable/white"/>
        <TextView 
            android:text="My Account" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#000000" />
    </LinearLayout>

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_weight="1"
        android:orientation="vertical" 
        android:gravity="center">

        <ImageButton
            android:id="@+id/btnFeedback"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/white"
            android:src="@drawable/feedback_icon" />

        <TextView 
            android:text="Feedback" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#000000" />
    </LinearLayout>
</LinearLayout>

<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_weight="1"
    android:layout_marginBottom="20px"
    android:weightSum="3" 
    android:orientation="horizontal">
    <!-- dont change the above value of 45px in 
    android:layout_marginBottom="45px"-->

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_weight="1"
        android:orientation="vertical" 
        android:gravity="center">
        <ImageButton 
            android:id="@+id/btnPromotions"
            android:src="@drawable/promotion_icon"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:background="@drawable/white" />
        <TextView 
            android:text="Promotions" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#000000"/>
    </LinearLayout>
    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_weight="1"
        android:orientation="vertical" 
        android:gravity="center"
        android:layout_height="fill_parent" >

        <ImageButton 
            android:id="@+id/btnTradeTools"
            android:src="@drawable/tradetools_icon"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:background="@drawable/white" />
        <TextView 
            android:text="Trade Tools" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:textColor="#000000"/>
    </LinearLayout>

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:layout_weight="1"
        android:orientation="vertical" 
        android:gravity="center">
        <ImageButton 
            android:id="@+id/btnClientInfo"
            android:src="@drawable/clientinfo_icon"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:background="@drawable/white"/>
        <TextView 
            android:text="About" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:textColor="#000000"/>
    </LinearLayout>
</LinearLayout>
</LinearLayout>

   <LinearLayout
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent" 
        android:layout_height="30dip"
        android:layout_weight="1"
        android:weightSum="5" 
        android:orientation="horizontal"
        android:background="#e4e4e4"
        android:tileMode="repeat">
<include layout="@layout/footer_include_layout"/>




         </LinearLayout>

1 个答案:

答案 0 :(得分:0)

变形金刚有~160dpi,这使它成为一个mdpi屏幕。因此,从mdpi文件夹

加载资源是很自然的