Java Android的布局问题
嗨,我正在测试Nexus 5和三星Galaxy S4上的应用程序。它们都有非常相似的屏幕大小和分辨率。我认为唯一的区别是三星是5英寸,Nexus是4.8英寸。因此,我目前的布局如下:Java Android的布局问题,java,android,android-layout,layout,android-xml,Java,Android,Android Layout,Layout,Android Xml,嗨,我正在测试Nexus 5和三星Galaxy S4上的应用程序。它们都有非常相似的屏幕大小和分辨率。我认为唯一的区别是三星是5英寸,Nexus是4.8英寸。因此,我目前的布局如下: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/photo_background_flip"
android:tag="normal_xhdpi"
android:id="@+id/right_hearing_test">
<ScrollView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_below="@id/title_bar"
android:id="@+id/scroll_view"
android:fadingEdge="none"
>
<include
layout="@layout/right_hearing_test_internal"/>
</ScrollView>
</RelativeLayout>
其中包括以下布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scroll_frame">
<ImageView
android:id="@+id/instructions"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_marginTop="170dp"
android:scaleType="fitXY"
android:src="@drawable/bkgnd_instructions" />
<Button
android:id="@+id/instructionsbutton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/instructions"
android:layout_marginTop="250dp"
android:background="@color/dark_gray"
android:drawableLeft="@drawable/arrow_down_float"
android:gravity="left"
android:onClick="onMoreInstructions"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="@string/more_instructions_start"
android:textColor="@color/solid_white" />
</RelativeLayout>
还有另一种观点:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button_holder"
>
<Button
android:text="@string/start_test"
android:id="@+id/start_test"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginTop="100dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginBottom="20dip"
android:onClick="onClickHandler"
/>
<Button
android:text="@string/more_instructions_start"
android:id="@+id/more_instructions"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:onClick="onMoreInstructions"
android:layout_below="@id/start_test"
android:background="@color/dark_gray"
android:textColor="@color/solid_white"
android:gravity="left"
android:paddingTop="3dp"
android:paddingBottom="4dp"
android:drawableLeft="@drawable/arrow_down_float"
/>
</LinearLayout>
我遇到的问题是,
more\u instructions
按钮应该位于页面的最底部;它在Nexus上,但在三星上,它略高一些,看起来很奇怪。它们都放在同一个“布局文件夹”中,即“布局普通xhdpi”。我如何才能得到它,使按钮是在同一个地方的两个手机以及其他类似大小的手机具有类似的分辨率?谢谢如果我理解正确,问题是您最后的“视图”,您正在使用线性布局
和两个按钮
s,其中一个带有id更多说明
?您是否尝试过使用RelativeLayout
?我将试一试,看看它是什么样子,非常感谢