2015-05-02 2 views
1

Im работает над моим новым проектом. Im новое на Android Developing. Когда я использую этот код, он говорит: «Этот макет ScrollView или его родитель RelativeLayout бесполезен». Как я могу это решить?Этот макет ScrollView или его родственник RelativeLayout бесполезен

<ScrollView 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_marginBottom="3dp"> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:background="#000" 
    android:orientation="vertical" 
    android:layout_height="wrap_content" > 

    <TextView 
     android:id="@+id/description_text" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:maxLines="5" 
     android:text="@string/desc_content" /> 

    <ImageButton 
     android:id="@+id/show" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:contentDescription="@string/Rom_Baslik" 
     android:layout_alignParentRight="true" 
     android:layout_below="@+id/description_text" 
     android:background="@drawable/arrowdown" 
     android:clickable="true" /> 

    <View 
     android:id="@+id/view1" 
     android:layout_width="wrap_content" 
     android:layout_height="2dp" 
     android:layout_below="@+id/description_text" 
     android:layout_marginTop="5dp" 
     android:layout_toLeftOf="@+id/show" 
     android:background="#000" /> 

    <ImageButton 
     android:id="@+id/hide" 
     android:layout_width="wrap_content" 
     android:contentDescription="@string/Rom_Baslik" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_below="@+id/description_text" 
     android:background="@drawable/ic_collapse_small_holo_light" 
     android:clickable="true" 
     android:visibility="invisible" /> 
</RelativeLayout> 

Я хочу ExpandableTextView:/

+0

Это всего лишь намек, и в нем говорится: «Возможно, это бесполезно». Потому что это может быть так, что вы создаете элементы макета программно. Но если вы этого не сделаете, удалите родителя 'RelativeLayout'. –

ответ

0

Если единственный ребенок ViewGroup еще один ViewGroup, что делает один из ViewGroups бесполезных.

Для решения проблемы удалите родителя RelativeLayout.

+0

Спасибо: D Это сработало – Ataberk

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