Java – layout parameter layout_ Weight is ignored unless layout is also specified on the tag_ Width and layout_ height

I treat this message as an error and cannot run the application

<include 
    android:layout_weight="1"
    layout="@layout/button_row"/>
<include 
    android:layout_weight="1"
    layout="@layout/button_row"/>
<include 
    android:layout_weight="1"
    layout="@layout/button_row"/>    
 <include 

    layout="@layout/button_row"
    android:layout_weight="1"/>

android:layout_ The line weight = "1" causes an error However, they make the layout file look like it needs to (in the screenshot)

The following are the contents of the include tag

<style name="RemoteButton">
    <item name="android:layout_width"> 0dp </item>
    <item name="android:layout_height"> match_parent </item>`

How do I make it look like I need no mistakes? thank you

Solution

Set styles XML changed to this

<style name="RemoteButton">
    <item name="android:layout_width"> 0dp </item>
    <item name="android:layout_height"> match_parent </item>
    <item name="android:layout_weight">1</item>
<style>
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
分享
二维码
< <上一篇
下一篇>>