Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/219.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nexus4与Nexus7的Android布局_Android_Android Layout - Fatal编程技术网

Nexus4与Nexus7的Android布局

Nexus4与Nexus7的Android布局,android,android-layout,Android,Android Layout,我在Nexus 4:)中预览我的Android应用程序。给你 但当我尝试在Nexus7模拟器上预览时:( 我认为我在游戏中支持多个屏幕时遇到了问题。 我的问题是,如何在Nexus7或10或任何其他设备上使其看起来更大 顺便说一句,我把我的图片(board.png、small_hole.png、big_hole.png和bg.png)放在可绘制的xhdpi文件夹(我使用的是Android Studio)上 您认为我在xml文件中使用了错误的布局或属性吗?我的代码中是否有错误 这是我的xml布局

我在Nexus 4:)中预览我的Android应用程序。给你

但当我尝试在Nexus7模拟器上预览时:(

我认为我在游戏中支持多个屏幕时遇到了问题。 我的问题是,如何在Nexus7或10或任何其他设备上使其看起来更大

顺便说一句,我把我的图片(board.png、small_hole.png、big_hole.png和bg.png)放在可绘制的xhdpi文件夹(我使用的是Android Studio)上

您认为我在xml文件中使用了错误的布局或属性吗?我的代码中是否有错误

这是我的xml布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg.png>

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/board"
        android:orientation="horizontal" >

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="20dp" >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/big_hole" >
            </ImageView>
        </FrameLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_gravity="center_vertical">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginBottom="2dp">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/small_hole" >
                </ImageView>

                // paste 6 more ImageViews here

            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginTop="7dp">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/small_hole" >
                </ImageView>

               // paste 6 more ImageViews here

            </LinearLayout>

        </LinearLayout>

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginRight="20dp" >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scaleType="fitCenter"
                android:background="@drawable/big_hole" >
            </ImageView>

        </FrameLayout>

    </LinearLayout>

</RelativeLayout>

尝试将图像放在res/mdpi中,它们将被拉伸以适应更大的屏幕(hdpi、xhdpi)
(如果我没记错的话,hdpi和xhdpi的modyfier是x1.5和x2)


或者,您可以为更大的屏幕创建一个布局文件夹,即layout-sw720dp,并在那里创建一个新的布局文件。

Nexus 4 access
drawable xhdpi
参考资料和

Nexus 7 access
drawable大型tvdpi
drawable-sw600dp-tvdpi
资源

Nexus 10 access
drawable xlarge xhdpi
drawable-sw720dp-xhdpi
资源

你应该调整你的图片大小,并把它放在各自的文件夹里

Nexus4的尺寸为4.7英寸(768*1280),Nexus7的尺寸为7英寸(800*1280)

更多信息:


欢迎好友..使用nexus 10的
drawable-sw720dp-xhdpi