R
RaRu
Neues Mitglied
- 0
Guten Tach!
Ich habe ein linearLayout welches u.a. noch ein linearLayout enthält.
Wenn ich nun auf das zweite (sub)linearLayout ein removeAllViews() mache, sollte dies eigentlich alle Buttons darin entfernen. Leider wird aber auch der Inhalt des parent linearLayout gelöscht, also quasi alles.
Ist sicher ein einfacher Fehler, oder? ;-) Hilfe!
Ich habe ein linearLayout welches u.a. noch ein linearLayout enthält.
Wenn ich nun auf das zweite (sub)linearLayout ein removeAllViews() mache, sollte dies eigentlich alle Buttons darin entfernen. Leider wird aber auch der Inhalt des parent linearLayout gelöscht, also quasi alles.
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Layout01"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@color/white">
<TextView
android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/textcolor"/>
<ImageView
android:id="@+id/ImageView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Code:
[...]
setContentView(R.layout.main);
imgView = (ImageView) findViewById(R.id.ImageView01);
subLinearLayout = (android.widget.LinearLayout) findViewById(R.id.Layout01);
[...]
// fülle das sublinearlayout
[...]
subLinearLayout.removeAllViews();
Ist sicher ein einfacher Fehler, oder? ;-) Hilfe!