Android 警告:由于本地化文本扩展而增长
Android Warning : Grows due to localized text expansion
我收到此类警告
@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>
有人知道这种类型的警告吗?
提前感谢:)
我刚刚将第一个 AppCompatTextView
的宽度更改为 match_parent
并添加了以下两行:
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>
问题在几分钟内就解决了,而且很容易理解。
可能对其他人有帮助。
我收到此类警告
@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>
有人知道这种类型的警告吗?
提前感谢:)
我刚刚将第一个 AppCompatTextView
的宽度更改为 match_parent
并添加了以下两行:
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>
问题在几分钟内就解决了,而且很容易理解。
可能对其他人有帮助。