Android – using layout_ Height is 0dip instead of wrap_ Content for better performance… How to delete this warning
•
Android
How do I delete this warning?
Using layout_ Height is 0dip instead of wrap_ Content can get better performance
resolvent:
OK, let me explain it through an example,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Hello World!!" />
</LinearLayout>
In the above example, I use Android: layout_ Weight = "1" is used for textview. I tell the layout that my textview will adopt the full height of the parent layout (LinearLayout). Therefore, in this case, Android: layout_ Height = "wrap_content" is useless because textview will have full size as the parent LinearLayout. Therefore, in this case, it is best to add Android: layout_ Height = "0dp" to make textview wrap itself to the height of the parent layout
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码