2017-06-29 2 views
0

Fehler definiert werden sollFehler mit ‚layout_height‘ Attribute sollen mit ‚layout_height‘ Attribute

I verwendet definiert werden, um neues Android-Projekt zu erstellen und ConstraintLayout zu Linearlayout ändern, aber es ist Show Fehler mit Radiobutton

„‘ Das Attribut 'layout_height' sollte weniger definiert werden. Validiert Ressourcenverweise in Android-XML-Dateien. "

Wie kann ich tun. danke

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <RadioGroup android:id="@+id/orientation" 
     android:orientation="horizontal" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:padding="50dp"> 
     <RadioButton android:id="@+id/horizontal"  <<< error 
      android:text="ddd" /> 
     <RadioButton android:id="@+id/vertical"  <<< error 
      android:text="d" /> 
    </RadioGroup> 
     <RadioGroup android:id="@+id/gravity" 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:padding="50dp"> 
      <RadioButton       <<< error 
       android:id="@+id/left" 
       android:text="dd" /> 
      <RadioButton        <<< error 
       android:id="@+id/center" 
       android:text="cc" /> 
      <RadioButton         <<< error 
       android:id="@+id/right" 
       android:text="cc" /> 
     </RadioGroup> 
</LinearLayout> 
+1

hinzufügen 'android: layout_height =" wrap_content "' und 'android: layout_width =" wrap_content "' .jeder Ansicht erfordert Höhe und Breite Attribute. – Adithya

Antwort

1

android:layout_height und android:layout_width Attribute für die Radio-Buttons hinzufügen, und Sie den Fehler auf magische Weise

verschwindet :-) sehen
0

Sie das Layout Höhe und Breite angeben müssen. Der bearbeitete Code ist

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <RadioGroup 
     android:id="@+id/orientation" 
     android:orientation="horizontal" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:padding="50dp"> 

     <RadioButton 
      android:id="@+id/horizontal"  
      android:text="ddd" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"/> 

     <RadioButton 
      android:id="@+id/vertical" 
      android:text="d" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
    </RadioGroup> 

     <RadioGroup 
      android:id="@+id/gravity" 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:padding="50dp"> 
      <RadioButton       
       android:id="@+id/left" 
       android:text="dd" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" /> 
      <RadioButton        
       android:id="@+id/center" 
       android:text="cc" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" /> 
      <RadioButton         
       android:id="@+id/right" 
       android:text="cc" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"/> 
     </RadioGroup> 
</LinearLayout> 
0

Sie versuchen, RadioButton ohne Höhe und Gewicht zu setzen fügen diese Attribute in RadioButton.

Verwandte Themen