我收到这种警告
如果@ id / order_row_date由于本地化文本扩展而增加,则@ id / order_row_date可以与@ id / order_row_amout重叠。
如果相对布局的文本或按钮项目左右对齐,则它们可以由于局部文本扩展而彼此重叠,除非它们具有诸如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>
问题只需几分钟即可解决,而且非常容易理解。
可能对别人有帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句