i have an layout consisting of two frame layout, my first Frame layout consist of the buttons,and another Frame layout is blank ,on click event on the button in first frame layo
This was the Finalized Solution to my problem.
On the click event of my button i Just have to set the Visibility of the Desired framelayout to be visible.
/////////////////////////// The XML LAYOUT//////////////////////////////////////////
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/mainliner"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_below="@+id/relative"
android:background="#454565">
<FrameLayout
android:id="@+id/leftlayout"
android:layout_width="50dp"
android:layout_height="300dp"
android:layout_marginTop="50dp">
<LinearLayout
android:id="@+id/liner"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginTop="10dp"
android:background="#FF9B00"
android:orientation="vertical">
<Button
android:id="@+id/btn1"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="firstButton"
android:textColor="#000000"
android:padding="1dp"
android:background="@drawable/roundbtn"
android:text="A"/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="secondButton"
android:textColor="#000000"
android:padding="1dp"
android:layout_marginTop="5dp"
android:background="@drawable/roundbtn"
android:text="B"/>
<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="thirdButton"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:background="@drawable/roundbtn"
android:padding="1dp"
android:text="C"/>
<Button
android:id="@+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:background="@drawable/roundbtn"
android:padding="1dp"
android:layout_marginTop="5dp"
android:onClick="fourthButton"
android:text="D"/>
<Button
android:id="@+id/btn5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:background="@drawable/roundbtn"
android:layout_marginTop="5dp"
android:onClick="fifthButton"
android:text="E"/>
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/rightframeone"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#123139"
android:visibility="invisible">
<GridView
android:id="@+id/gridView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:columnWidth="80dp"
android:gravity="center"
android:numColumns="auto_fit"
android:stretchMode="columnWidth" >
</GridView>
</FrameLayout>
<FrameLayout
android:id="@+id/rightframetwo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#121232"
android:visibility="invisible">
<ImageView
android:id="@+id/imageview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/aaaimage"
/>
</FrameLayout>
<FrameLayout
android:id="@+id/rightframethree"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#454425"
android:visibility="invisible">
<ImageView
android:id="@+id/imagevieww"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/bstclass"
/>
</FrameLayout>
<FrameLayout
android:id="@+id/rightframefour"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#567004"
android:visibility="invisible">
<ImageView
android:id="@+id/imageviewww"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/bstteam"
/>
</FrameLayout>
<FrameLayout
android:id="@+id/rightframefive"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#324888"
android:visibility="invisible">
<ImageView
android:id="@+id/imageviewwww"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/training"
/>
</FrameLayout>
</LinearLayout>
</RelativeLayout>
//////////////////The Method to the triggered in the Class on the click event////////////////////
This the functionality we need to do on our button
public void firstButton(View view)
{
frmtwo.setVisibility(View.INVISIBLE);
frmtwo.setVisibility(View.GONE);
frmthree.setVisibility(View.INVISIBLE);
frmthree.setVisibility(View.GONE);
frmfour.setVisibility(View.INVISIBLE);
frmfour.setVisibility(View.GONE);
frmfiv.setVisibility(View.INVISIBLE);
frmfiv.setVisibility(View.GONE);
frmone.setVisibility(View.VISIBLE);
}
you have to use fragment for that.
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager
.beginTransaction();
CalculatorTwo calculator = new CalculatorTwo();
fragmentTransaction.setCustomAnimations(R.anim.slide_top,
R.anim.slide_down);
fragmentTransaction.add(R.id.content_first, calculator);
ragmentTransaction.commit();