【发布时间】:2014-12-15 11:39:53
【问题描述】:
我在 Nexus 4 中预览我的 Android 应用 :)。在这里
但是当我尝试在 Nexus 7 模拟器上预览它时,:(
我认为我在支持我的游戏中的多个屏幕时遇到了问题。 我的问题是,如何让它在 nexus 7 或 10 或任何其他设备上看起来更大?
顺便说一句,我将图像(board.png、small_hole.png、big_hole.png 和 bg.png)放在 drawable-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>
谢谢你们..
【问题讨论】: