2013-12-23 32 views
0

我想在5.4「,7」和10.1「的超大屏幕上的Android設置用戶界面。我無法在以下屏幕上設置用戶界面。因爲我在layout-xhdpi中設置了它的接口,但它正在選擇layout-mdpi。請指導我如何解決這個問題。如何在android中的5.4'',7''和10.1''屏幕上設置UI?

這個人是佈局MDPI代碼

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/bg" 
android:orientation="vertical" 
tools:context=".MainActivity" > 

<RelativeLayout 
    android:id="@+id/appheader" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_marginTop="45dp" > 

    <TextView 
     android:id="@+id/textviewquestionnumber" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_marginLeft="35dp" 
     android:background="@drawable/no_circle" 
     android:gravity="center" 
     android:text="0" 
     android:textSize="20sp" 
     android:textStyle="bold" /> 

    <TextView 
     android:id="@+id/textviewscore" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:background="@drawable/score_border" 
     android:gravity="center" 
     android:paddingLeft="10dp" 
     android:paddingRight="10dp" 
     android:text="Score: 0" 
     android:textSize="15dp" 
     android:textStyle="bold" /> 

    <ImageButton 
     android:id="@+id/imagebtnhint" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="35dp" 
     android:background="@drawable/hintbuttonselector" 
     android:gravity="center" /> 
    </RelativeLayout> 

    <ImageView 
    android:id="@+id/imageviewQuestionImage" 
    android:layout_width="190dp" 
    android:layout_height="150dp" 
    android:layout_below="@+id/appheader" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="10dp" 
    android:background="@drawable/pic_box" /> 

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/imageviewQuestionImage" 
    android:paddingLeft="30dp" 
    android:paddingRight="30dp" 
    android:paddingBottom="30dp" 
    android:layout_marginTop="5dp" > 

    <Button 
     android:id="@+id/option1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/optionsselector" 
     android:textColor="@drawable/textcolorselector" /> 

    <Button 
     android:id="@+id/option2" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/option1" 
     android:layout_marginTop="15dp" 
     android:background="@drawable/optionsselector" 
     android:textColor="@drawable/textcolorselector" /> 

    <Button 
     android:id="@+id/option3" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/option2" 
     android:layout_marginTop="15dp" 
     android:background="@drawable/optionsselector" 
     android:textColor="@drawable/textcolorselector" /> 

    <Button 
     android:id="@+id/option4" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/option3" 
     android:layout_marginTop="15dp" 
     android:background="@drawable/optionsselector" 
     android:textColor="@drawable/textcolorselector" /> 
</RelativeLayout> 

<FrameLayout 
    android:id="@+id/googleads" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" > 

    <com.google.ads.AdView 
     xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
     android:id="@+id/adView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     ads:adSize="BANNER" 
     ads:adUnitId="" 
     ads:loadAdOnCreate="true" /> 
</FrameLayout> 

</RelativeLayout> 

這個代碼是佈局xhdpi

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/bg" 
android:orientation="vertical" 
tools:context=".MainActivity" > 

<RelativeLayout 
    android:id="@+id/appheader" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_marginTop="50dp" > 

    <TextView 
     android:id="@+id/textviewquestionnumber" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_marginLeft="35dp" 
     android:background="@drawable/no_circle" 
     android:gravity="center" 
     android:text="0" 
     android:textSize="20sp" 
     android:textStyle="bold" /> 

    <TextView 
     android:id="@+id/textviewscore" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:background="@drawable/score_border" 
     android:gravity="center" 
     android:paddingLeft="10dp" 
     android:paddingRight="10dp" 
     android:text="Score: 0" 
     android:textSize="15dp" 
     android:textStyle="bold" /> 

    <ImageButton 
     android:id="@+id/imagebtnhint" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="40dp" 
     android:background="@drawable/hintbuttonselector" 
     android:gravity="center" /> 
    </RelativeLayout> 

<ImageView 
    android:id="@+id/imageviewQuestionImage" 
    android:layout_width="190dp" 
    android:layout_height="150dp" 
    android:layout_below="@+id/appheader" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="30dp" 
    android:background="@drawable/pic_box" /> 

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/imageviewQuestionImage" 
    android:layout_marginTop="20dp" 
    android:paddingBottom="30dp" 
    android:paddingLeft="30dp" 
    android:paddingRight="30dp" > 

    <Button 
     android:id="@+id/option1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="30dp" 
     android:background="@drawable/optionsselector" 
     android:textColor="@drawable/textcolorselector" /> 

    <Button 
     android:id="@+id/option2" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/option1" 
     android:layout_marginTop="30dp" 
     android:background="@drawable/optionsselector" 
     android:textColor="@drawable/textcolorselector" /> 

    <Button 
     android:id="@+id/option3" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/option2" 
     android:layout_marginTop="30dp" 
     android:background="@drawable/optionsselector" 
     android:textColor="@drawable/textcolorselector" /> 

    <Button 
     android:id="@+id/option4" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/option3" 
     android:layout_marginTop="30dp" 
     android:background="@drawable/optionsselector" 
     android:textColor="@drawable/textcolorselector" /> 
</RelativeLayout> 

<FrameLayout 
    android:id="@+id/googleads" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" > 

    <com.google.ads.AdView 
     xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
     android:id="@+id/adView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     ads:adSize="BANNER" 
     ads:adUnitId="" 
     ads:loadAdOnCreate="true" /> 
</FrameLayout> 

</RelativeLayout> 
+0

發佈代碼的完整細節,以便我們可以幫助您 –

+0

看看這個有用的信息http://developer.android.com/guide/practices/screens_support.html –

回答

0

對於10" 平板電腦屏幕把你的佈局在佈局sw720dp和7" 平板電腦放您在layout-sw600dp中的佈局並查看此link中的開發者網站,有足夠的信息解決您的問題,並查看有用的信息here

+0

歡迎您 –

相關問題