大佬教程收集整理的这篇文章主要介绍了android – PercentRelativeLayout – layout_width缺少警告,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
除了抑制警告之外,还有办法解决这个问题吗?
例如:
<android.support.percent.PercentRelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.design.widget.TexTinputLayout android:id="@+id/expiry_month_wrapper" app:layout_widthPercent="25%" android:layout_height="wrap_content"> <EditText android:id="@+id/expiry_month_editText" android:layout_width="match_parent" android:layout_height="wrap_content" android:maxLength="2" android:hint="@String/month" android:focusable="true" android:inputType="number"/> </android.support.design.widget.TexTinputLayout> <!-- more TexTinputLayout fields --> </android.support.percent.PercentRelativeLayout>
TexTinputLayout上给出的警告.
将视图添加到PercentRelativeLayout将在文本编辑器中引发可视错误.它甚至可能无法在屏幕上呈现.继续运行您的模拟器,它应解决可见性问题.
要解决错误,只需添加android:layout_width =“0dp”只要你的widthPercent和heightPercent设置得恰当,你就不会有问题.
这是我测试代码的例子
android:text="Label label" android:id="@+id/btn1" android:layout_height="wrap_content" android:layout_width="0dp" android:layout_alignParentTop="true" app:layout_widthPercent="50%" app:layout_heightPercent="30%" android:textSize="17sp"/> <Button android:text="Other other other" android:id="@+id/btn2" android:layout_height="wrap_content" android:layout_width="0dp" android:layout_toRightOf="@id/btn1" app:layout_widthPercent="50%" app:layout_heightPercent="30%" android:textSize="17sp"/>
以上是大佬教程为你收集整理的android – PercentRelativeLayout – layout_width缺少警告全部内容,希望文章能够帮你解决android – PercentRelativeLayout – layout_width缺少警告所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。