java - Android: creating two linearlayout in single relative layout with on click button -


in single screen android project(using 1 xml file) when press button1 linerlayout1 open , when press button2 linearlayout2 open.my button1 , button2 placed in linearlayout3.can works??if yes how?? in advance.

       <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"        android:id="@+id/relativelayout1"        android:layout_width="fill_parent"        android:layout_height="fill_parent" >         <linearlayout        android:id="@+id/linearlayout1"        android:layout_width="fill_parent"        android:layout_height="50dp"        android:layout_above="@+id/linearlayout3"        android:layout_alignparentleft="true"        android:layout_alignparentright="true"        android:layout_alignparenttop="true"        android:orientation="vertical" >        <radiobutton       android:id="@+id/radiobutton3"       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="@string/linearlayout1" />       <radiobutton       android:id="@+id/radiobutton4"       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="@string/linearlayout1" />         </linearlayout>       <linearlayout      android:id="@+id/linearlayout3"      android:layout_width="fill_parent"      android:layout_height="50dp"      android:layout_alignparentbottom="true"      android:layout_alignparentright="true" >      <button     android:id="@+id/button1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/button1" />      <button     android:id="@+id/button2"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/button2" />      </linearlayout>     <linearlayout    android:id="@+id/linearlayout2"    android:layout_width="fill_parent"    android:layout_height="50dp"    android:layout_alignparentbottom="true"    android:layout_alignparentleft="true"    android:orientation="vertical" >      <radiobutton     android:id="@+id/radiobutton13"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/linearlayout2" />      <radiobutton     android:id="@+id/radiobutton14"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/linearlayout2" />           </linearlayout>          </relativelayout> 

yes, it's simple:

use android:visibility xml tag initially, , when each respective button pressed, you'd obtain reference linearlayouts, , set visibility visible or gone in code.

note: want use gone rather invisibile invisibile still take screen space, there'll large chunk of blank space before, whereas assume want them in place of each other


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -