Here my Code:
LinearLayout ll = (LinearLayout) View.inflate(TabAndPlay.this, R.layout.current_play, null);
TextView tv = new TextView(TabAndPlay.this);
tv.setText("hallo");
tv.setBackgroundColor(Color.GRAY);
ll.addView(tv);
current_play.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/aktuelle_spiele"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
R.id.llPlay (there xml shows so)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip">
<LinearLayout
android:id="@+id/llPlay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
</LinearLayout>
Here is the onOptionsItemSelected()
case R.id.current_play:
LinearLayout mainLayout = (LinearLayout) findViewById(R.id.llPlay);
mainLayout.removeAllViews();
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.current_play, mainLayout, true);
return true;
If i click on my menu item, all my current views on R.id.llPlays are removed! The button from current_play is shown. But the TextView from "Here my code" dont show.. Why? Whre is my error?