我收到这种类型的警告
@id/order_row_date can overlap @id/order_row_amout if @id/order_row_date grows due to localized text expansion.
If relative layout has text or button items aligned to left and right sides they can overlap each other due to localized text expansion unless they have mutual constraints like toEndOf/toStartOf.
我的 XML 文件是:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/order_row_lower_layout"
android:layout_below="@+id/order_row_upper_layout"
android:layout_toEndOf="@+id/order_row_box_layout"
android:layout_toRightOf="@+id/order_row_box_layout"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/order_row_amout"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:textColor="@color/color_gray"
android:textStyle="bold"
android:text="50000"
tools:text="@string/string_amout_with_ruppe" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/order_row_date"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:textColor="@color/color_gray"
tools:text="08/09/2016" />
</RelativeLayout>
有人知道这种类型的警告吗?
提前感谢:)
最佳答案
我刚刚用 match_parent
更改了第一个 AppCompatTextView
的宽度,并添加了以下两行:
android:layout_toLeftOf="@+id/order_row_date"
android:layout_toStartOf="@+id/order_row_date"
所以最终的 XML:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/order_row_lower_layout"
android:layout_below="@+id/order_row_upper_layout"
android:layout_toEndOf="@+id/order_row_box_layout"
android:layout_toRightOf="@+id/order_row_box_layout"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/order_row_amout"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_toLeftOf="@+id/order_row_date"
android:layout_toStartOf="@+id/order_row_date"
android:textColor="@color/color_gray"
android:textStyle="bold"
android:text="50000"
tools:text="@string/string_amout_with_ruppe" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/order_row_date"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:textColor="@color/color_gray"
tools:text="08/09/2016" />
</RelativeLayout>
问题在几分钟内就解决了,而且非常容易理解。
可能对其他人有帮助。
关于安卓警告 : Grows due to localized text expansion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39996476/