我有一个视图,该视图由使用裕度实现的特定顺序的许多按钮构成,但是由于某些原因,当我将应用程序推送到设备时,裕度最终反转了,因此得到了翻转的图像在小米荣誉android 5.1 api 22上,但在5.4 fwvga android 9 api 28上,一切都按预期进行。
我的主要活动xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
tools:context=".MainMap">
<android.support.constraint.ConstraintLayout
android:layout_width="@dimen/map_width"
android:layout_height="@dimen/map_height"
android:background="@drawable/menu_map"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/MaalotButton"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="32dp"
android:layout_height="10dp"
android:layout_marginStart="96dp"
android:layout_marginLeft="96dp"
android:layout_marginTop="28dp"
android:text="@string/PaPMaalot"
android:textSize="8sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/ShderotButton"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="32dp"
android:layout_height="10dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/PaPShderot"
android:textSize="8sp"
app:layout_constraintEnd_toEndOf="@+id/AshdodButton"
app:layout_constraintTop_toBottomOf="@+id/AshdodButton" />
<Button
android:id="@+id/KfarVardimButton"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="46dp"
android:layout_height="10dp"
android:layout_marginEnd="6dp"
android:layout_marginRight="6dp"
android:text="@string/PaPKfarVradim"
android:textSize="8sp"
app:layout_constraintEnd_toEndOf="@+id/MaalotButton"
app:layout_constraintTop_toBottomOf="@+id/MaalotButton" />
<Button
android:id="@+id/TalElButton"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="32dp"
android:layout_height="10dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/PaPTalEl"
android:textSize="8sp"
app:layout_constraintEnd_toEndOf="@+id/KfarVardimButton"
app:layout_constraintTop_toBottomOf="@+id/KfarVardimButton" />
<Button
android:id="@+id/CholonButton"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="32dp"
android:layout_height="10dp"
android:layout_marginTop="110dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:text="@string/PaPCholon"
android:textSize="8sp"
app:layout_constraintEnd_toStartOf="@+id/TalElButton"
app:layout_constraintTop_toBottomOf="@+id/TalElButton" />
<Button
android:id="@+id/AshdodButton"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="32dp"
android:layout_height="10dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="14dp"
android:layout_marginRight="14dp"
android:text="@string/PaPAshdod"
android:textSize="8sp"
app:layout_constraintEnd_toEndOf="@+id/CholonButton"
app:layout_constraintTop_toBottomOf="@+id/CholonButton" />
<Button
android:id="@+id/TfachotButton"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="32dp"
android:layout_height="10dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/PaPTfachot"
android:textSize="8sp"
app:layout_constraintEnd_toEndOf="@+id/BarYochayButton7"
app:layout_constraintTop_toBottomOf="@+id/BarYochayButton7" />
<Button
android:id="@+id/DaltonButton"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="32dp"
android:layout_height="10dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:text="@string/PaPDalton"
android:textSize="8sp"
app:layout_constraintStart_toEndOf="@+id/MaalotButton"
app:layout_constraintTop_toTopOf="@+id/MaalotButton" />
<Button
android:id="@+id/BarYochayButton7"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="38dp"
android:layout_height="10dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/PaPBarYochay"
android:textSize="8sp"
app:layout_constraintEnd_toEndOf="@+id/DaltonButton"
app:layout_constraintTop_toBottomOf="@+id/DaltonButton" />
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
我希望有一种模式,但是我会翻转过来。
答案 0 :(得分:1)
我相信这是您设置毛利的方式。您的设备很有可能将不同的语言设置为默认语言。
左边距-创建相对于左边的边距。
右边距-创建相对于右边的边距。
页边距开始-创建一个相对于设备书写系统起始处相对的页边距。
如果我的设备的语言是英语,即从左到右(LTR)的书写系统,则“保证金开始”与“保证金左边”基本相同。
但是,如果我的设备使用的语言是希伯来语,即从右到左(RTL)的书写系统,那么“保证金起始”就与“保证金权利”相同。
保证金结束-与保证金开始相反。
解决方案-如果您要创建与设备语言无关的边距,请删除所有marginStart和marginEnd属性,而仅使用marginLeft和marginRight属性。