0

我正在尝试在 5.4''、7'' 和 10.1'' 的超大屏幕上设置 android 中的用户界面。我无法在以下屏幕上设置用户界面。因为我在 layout-xhdpi 中设置了它的界面,但它正在选择 layout-mdpi。请指导我如何解决这个问题。

这是 layout-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>

此代码用于 layout-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>
4

1 回答 1

0

对于 10 英寸平板电脑屏幕,将您的布局放入 layout-sw720dp,对于 7 英寸平板电脑,将您的布局放入 layout-sw600dp 并查看此链接中的开发人员网站,有足够好的信息来解决您的问题,并在此处查看有用的信息.

于 2013-12-23T11:10:22.867 回答