So I currently have this XML layout for my android project:
<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" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" tools:context="bhavik.slidingmenu.activity.LogFragment"> <ScrollView android:layout_width="match_parent" android:layout_height="495dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <RelativeLayout android:id="@+id/relLayout1" android:layout_marginTop="20dp" android:layout_marginBottom="20dp" android:layout_width="match_parent" android:layout_height="match_parent"> <com.rockerhieu.emojicon.EmojiconTextView android:id="@+id/txtEmojicon1" android:text="\ue11b" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="45dp" android:textIsSelectable="true" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginLeft="35dp" android:layout_marginStart="20dp" /> <SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/seekBar1" android:max="10" android:progress="0" android:layout_alignTop="@+id/txtEmojicon1" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginTop="8dp" android:layout_marginLeft="90dp" android:layout_marginRight="75dp" /> </RelativeLayout> <RelativeLayout android:id="@+id/relLayout2" android:layout_marginTop="20dp" android:layout_marginBottom="20dp" android:layout_width="match_parent" android:layout_height="match_parent"> <com.rockerhieu.emojicon.EmojiconTextView android:id="@+id/txtEmojicon2" android:text="\ue11b" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="45dp" android:textIsSelectable="true" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginLeft="35dp" android:layout_marginStart="20dp" /> <SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/seekBar2" android:max="10" android:progress="0" android:layout_alignTop="@+id/txtEmojicon2" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginTop="8dp" android:layout_marginLeft="90dp" android:layout_marginRight="75dp" /> </RelativeLayout> </LinearLayout> </ScrollView> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/fab_ic_add" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" android:layout_marginBottom="@dimen/fab_button_margin_bottom" android:layout_marginRight="@dimen/fab_button_margin_right" app:elevation="6dp" app:pressedTranslationZ="12dp" app:borderWidth="0dp"/> </RelativeLayout> As you see in the code I have 2 relative layouts called relLayout1 and relLayout2. Lets say depending on the conditions, I want to only display relLayout1 and not relLayout2, how would I do that? Or the other way around?
Thanks!
No comments:
Post a Comment