используйте этот макет:
<?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">
<Button
android:text="Bt1"
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></Button>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/linearLayout1">
<ImageView
android:layout_width="wrap_content"
android:id="@+id/imageView1"
android:layout_height="wrap_content"
android:src="@drawable/icon"></ImageView>
</LinearLayout>
<Button
android:text="Bt2"
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></Button>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/linearLayout2">
<ImageView
android:layout_width="wrap_content"
android:id="@+id/imageView2"
android:layout_height="wrap_content"
android:src="@drawable/icon"></ImageView>
</LinearLayout>
<Button
android:text="Bt3"
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></Button>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/linearLayout3">
<ImageView
android:layout_width="wrap_content"
android:id="@+id/imageView3"
android:layout_height="wrap_content"
android:src="@drawable/icon"></ImageView>
</LinearLayout>
</LinearLayout>
и используйте этот код:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
findViewById(R.id.linearLayout1).setVisibility(View.GONE);
findViewById(R.id.linearLayout2).setVisibility(View.GONE);
findViewById(R.id.linearLayout3).setVisibility(View.GONE);
Button bt1=(Button) findViewById(R.id.button1);
Button bt2=(Button) findViewById(R.id.button2);
Button bt3=(Button) findViewById(R.id.button3);
bt1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
findViewById(R.id.linearLayout1).setVisibility(View.VISIBLE);
findViewById(R.id.linearLayout2).setVisibility(View.GONE);
findViewById(R.id.linearLayout3).setVisibility(View.GONE);
}
});
bt2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
findViewById(R.id.linearLayout1).setVisibility(View.GONE);
findViewById(R.id.linearLayout2).setVisibility(View.VISIBLE);
findViewById(R.id.linearLayout3).setVisibility(View.GONE);
}
});
bt3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
findViewById(R.id.linearLayout1).setVisibility(View.GONE);
findViewById(R.id.linearLayout2).setVisibility(View.GONE);
findViewById(R.id.linearLayout3).setVisibility(View.VISIBLE);
}
});
}
Вы можете использовать свой макет в linearlayout1, linearlayout2 и linearlayout3 для панели стека сборки для Android.