Android 安卓:同一型号的两部手机的屏幕布局看起来不一样
我正在alpha测试一个应用程序,因此人们第一次在多个设备上查看它。一个人告诉我他屏幕上的按钮被切断了 奇怪的是,我们用的是同一台设备。我们都使用三星Galaxy S3,所以我们的屏幕分辨率应该是相同的Android 安卓:同一型号的两部手机的屏幕布局看起来不一样,android,xml,android-layout,galaxy,Android,Xml,Android Layout,Galaxy,我正在alpha测试一个应用程序,因此人们第一次在多个设备上查看它。一个人告诉我他屏幕上的按钮被切断了 奇怪的是,我们用的是同一台设备。我们都使用三星Galaxy S3,所以我们的屏幕分辨率应该是相同的 在他(或我)的手机上是否有一些设置,他可能会改变分辨率以看到更大的东西?(类似于浏览器中的ctrl+) 还有什么会导致这种情况 屏幕截图和XML包含在下面。右侧的差异:文本较大,缺少自制省略号,设置按钮被切断 通过使用sp指定字体大小,您做的每件事都是正确的。这将根据系统范围的字体比例缩放您
通过使用sp
指定字体大小,您做的每件事都是正确的。这将根据系统范围的字体比例缩放您选择的字体。其中一个用户增加了系统范围的字体大小。在AOSP手机上,这在设置/显示/字体大小中。三星设备也应该处于类似的位置。天哪,你说得对。太可怕了!是否可以从应用程序中检测到??我需要重新控制screenWell,您可以将fontsize指定为dp
,而不是sp
。您也可以通过查看DisplayMetrics
.FWIW中的内容进行检查。我通常为按钮文本指定dp
,为编辑框和更大的文本区域指定sp
。谢谢-这是一个巨大的帮助!
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.farmsoft.lunchguru.app.Pick_Restaurant"
android:layout_height="match_parent"
android:layout_width="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/PickRest_Header"
android:textStyle="bold"
android:textSize="20sp"
android:gravity="center_horizontal"
android:id="@+id/Lbl_Title"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/PickRest_CompanionHdr"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/Companion_Box">
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:orientation="horizontal">
<Button
android:layout_width="45dp"
android:layout_height="30dp"
android:text="•••"
android:gravity="top"
android:id="@+id/More_Companions"
android:onClick="onClick_More_Companions"/>
</LinearLayout>
<Space
android:layout_width="0dip"
android:layout_height="35dp" />
<com.farmsoft.lunchguru.utils.ListButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/PickRest_Recommend_Button"
android:id="@+id/Recommend_Button"
android:onClick="onClick_Recommend"
android:enabled="false"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/OR"
android:gravity="center_horizontal"
android:textSize="10pt"
android:textStyle="bold"/>
<com.farmsoft.lunchguru.utils.ListButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/PickRest_Nearby_Button"
android:id="@+id/Nearby_Button"
android:onClick="onClick_Nearby"
android:enabled="false"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/OR"
android:gravity="center_horizontal"
android:textSize="10pt"
android:textStyle="bold"/>
<com.farmsoft.lunchguru.utils.ListButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/PickRest_Search_Button"
android:id="@+id/Search_Button"
android:onClick="onClick_Search"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Lbl_Version"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Lbl_Coordinates"
android:text="@string/PickRest_Coordinates_Load"/>
<Space
android:layout_width="0dip"
android:layout_height="35dp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/PickRest_IAteThere_Button"
android:id="@+id/Attend_Button"
android:onClick="onClick_Attend"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Ratings_Button"
android:text="@string/PickRest_Rating_Button"
android:onClick="onClick_Ratings"
android:enabled="false"/>
<Space
android:layout_width="0dp"
android:layout_height="0dip"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Settings_Button"
android:text="@string/PickRest_Settings_Button"
android:onClick="onClick_Settings"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Connections_Button"
android:text="@string/PickRest_Connections_Button"
android:onClick="onClick_Connections"/>
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
</ScrollView>