2016-11-08 2 views
0

У меня есть 3 макета: 'a', 'b', 'c'.Два уровня макета включают в себя: Android

'a' включен в 'b', а 'b' включен в 'c'. но когда c отображается, он показывает мне содержание «b» только без «a».

- это потому, что я не могу иметь многоуровневый интерфейс?

код раскладки:

а: -

<?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"> 

    <LinearLayout 
     android:id="@+id/AdInfoDetails" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/searchLayout" 
     android:layout_marginBottom="15dp" 
     android:layout_marginTop="15dp" 
     android:layoutDirection="rtl" 
     android:orientation="horizontal"> 


     <EditText 
      android:id="@+id/AdNo" 
      android:layout_width="80dp" 
      android:layout_height="wrap_content" 
      android:hint="العدد" 
      android:inputType="number" /> 

     <RadioGroup 
      android:id="@+id/AdStatusGroup" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="15dp" 
      android:layout_marginRight="15dp" 
      android:orientation="horizontal" 
      android:weightSum="4"> 

      <RadioButton 
       android:id="@+id/AdStatus1" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_weight="1" 
       android:text="@string/excellent" /> 

      <RadioButton 
       android:id="@+id/AdStatus2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:text="@string/good" /> 

      <RadioButton 
       android:id="@+id/AdStatus3" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:text="@string/bad" /> 


     </RadioGroup> 


    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/BadAdInfoDetails" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/searchLayout" 
     android:layout_marginBottom="15dp" 
     android:layout_marginTop="15dp" 
     android:layoutDirection="rtl" 
     android:gravity="left" 
     android:orientation="horizontal" 
     android:weightSum="2"> 


     <RadioGroup 
      android:id="@+id/BadAdStatusGroup" 
      android:layout_width="294dp" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="15dp" 
      android:layout_marginRight="15dp" 
      android:orientation="horizontal" 
      android:weightSum="4"> 

      <RadioButton 
       android:id="@+id/BadAdStatus1" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_weight="1" 
       android:text="@string/excellent" /> 

      <RadioButton 
       android:id="@+id/BadAdStatus2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:text="@string/good" /> 

      <RadioButton 
       android:id="@+id/BadAdStatus3" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:text="@string/bad" /> 


     </RadioGroup> 


    </LinearLayout> 


</LinearLayout> 

б: -

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

    <LinearLayout 
     android:id="@+id/zainInfo" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/searchLayout" 
     android:layout_weight="3" 
     android:background="#D8BFD8" 
     android:orientation="vertical" 
     android:layoutDirection="rtl" 
     android:visibility="visible"> 

     <LinearLayout 
      android:id="@+id/zainInfoDetails1" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/searchLayout" 
      android:layout_marginBottom="15dp" 
      android:layout_marginTop="15dp" 
      android:layout_weight="3" 
      android:layoutDirection="rtl" 
      android:orientation="horizontal"> 




      <CheckBox 
       android:id="@+id/zainStickCB" 
       android:layout_width="105dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true" 
       android:layout_alignParentTop="true" 
       android:layout_gravity="fill" 
       android:layout_marginBottom="5dp" 
       android:layout_marginLeft="15dp" 
       android:layout_marginTop="5dp" 
       android:text="@string/stickers" 
       android:textDirection="rtl" 
       android:textSize="20dp" /> 


      <include layout="@layout/ad_type" android:id="a"/> 


     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/zainInfoDetails2" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/searchLayout" 
      android:layout_marginBottom="15dp" 
      android:layout_marginTop="15dp" 
      android:layout_weight="3" 
      android:orientation="horizontal"> 

      <CheckBox 
       android:id="@+id/zainDangCB" 
       android:layout_width="105dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true" 
       android:layout_alignParentTop="true" 
       android:layout_gravity="fill" 
       android:layout_marginBottom="5dp" 
       android:layout_marginLeft="15dp" 
       android:layout_marginTop="5dp" 
       android:text="@string/danglers" 
       android:textDirection="rtl" 
       android:textSize="20dp" /> 


      <include layout="@layout/ad_type" android:id="a"/> 



     </LinearLayout> 


     <LinearLayout 
      android:id="@+id/zainInfoDetails3" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/searchLayout" 
      android:layout_marginBottom="15dp" 
      android:layout_marginTop="15dp" 
      android:layout_weight="3" 
      android:orientation="horizontal"> 

      <CheckBox 
       android:id="@+id/zainWashCB" 
       android:layout_width="105dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true" 
       android:layout_alignParentTop="true" 
       android:layout_gravity="fill" 
       android:layout_marginBottom="5dp" 
       android:layout_marginLeft="15dp" 
       android:layout_marginTop="5dp" 
       android:text="@string/wash_lines" 
       android:textDirection="rtl" 
       android:textSize="20dp" /> 

      <include layout="@layout/ad_type" android:id="a" /> 

     </LinearLayout> 


    </LinearLayout> 

</LinearLayout> 

с: -

<LinearLayout 
       android:id="@+id/mtnInfo" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_below="@+id/searchLayout" 
       android:layout_weight="3" 
       android:background="#FFFFE0" 
       android:orientation="vertical" 
       android:visibility="visible"> 




       <include layout="@layout/b" 


      </LinearLayout> 

ответ

0

В макете b изменить начинку к wrap_content

android:layout_height="match_parent" 

в

android:layout_height="wrap_content" 

Это идет для каждого вида макета, который вы хотите включить. Как только вы установите его на match_parent, другие макеты не будут иметь места.

+0

изменить его, ничего не изменилось:/ –

+0

@AhmedAbdElmoniem Что именно вы делали? –

+0

@AhmedAbdElmoniem Подождите, вы буквально используете 'match_parent' на каждом макете. Исправьте это с помощью 'wrap_content'. В противном случае макеты не имеют места друг для друга, потому что есть тот, у которого 'match_parent' принимает их все. –

Смежные вопросы