Android 不同屏幕尺寸上的框架布局
您好,我正在开发“鼓应用”应用程序,我希望该应用程序看起来像真正的鼓,因此,在主屏幕上,我设置了鼓的背景,在背景上,我有一些带有鼓垫的图像按钮,我以前在photoshop中剪切过这些按钮: 现在,当我尝试将“ImageButtons”放置到正确的位置时,它在一台设备上看起来不错,但在另一台设备上看起来是这样的: 这是我的密码:Android 不同屏幕尺寸上的框架布局,android,android-framelayout,Android,Android Framelayout,您好,我正在开发“鼓应用”应用程序,我希望该应用程序看起来像真正的鼓,因此,在主屏幕上,我设置了鼓的背景,在背景上,我有一些带有鼓垫的图像按钮,我以前在photoshop中剪切过这些按钮: 现在,当我尝试将“ImageButtons”放置到正确的位置时,它在一台设备上看起来不错,但在另一台设备上看起来是这样的: 这是我的密码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http:/
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/drums" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="200dp"
android:layout_marginTop="30dp"
android:background="@android:color/transparent"
android:src="@drawable/image2" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginTop="50dp"
android:background="@android:color/transparent"
android:src="@drawable/image3" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="93dp"
android:layout_marginTop="13dp"
android:background="@android:color/transparent"
android:src="@drawable/image4" />
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="235dp"
android:layout_marginTop="95dp"
android:background="@android:color/transparent"
android:src="@drawable/image1" />
</FrameLayout>
</LinearLayout>
我该怎么处理?我想我什么都试过了!
这是这样思考的正确方式吗?好吧,你的方式可能不是解决这个问题的正确方式。首先,如果要相对于其他视图定位视图,应使用
RelativeLayout
-
其次,您应该为不同的密度提供不同的鼓png文件:。阅读“提供不同的png”部分
第三,您应该真正阅读多屏幕设计指南:
如果在此之后您还有任何其他问题,请毫不犹豫地提问。分享您的初始代码“我尝试了任何东西!”:那么就没有什么可以尝试的了;-)@royB我分享了我的代码。