0

I have searched a bit through the net but i haven't found any viable solution to my problem. I have a button within my XML file, however i would like to have 2 smaller buttons underneath it that are not visible. And at runtime when the button gets clicked the two others get visible. I know how to achieve the last part. The last button that is not within a relative layout, i would like to have invisible under button3.

However within my xml file i do not manage to place the buttons under the (super)button. Here is my XML code and i hope you guys can help out.

<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"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MyActivity">

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:orientation="horizontal"
    android:id="@+id/linearLayout3">

    <Button
        android:layout_width="75dp"
        android:layout_height="wrap_content"
        style="?android:attr/buttonBarButtonStyle"
        android:id="@+id/button1"
        android:textColor="#FFFFFF"
        android:background="@drawable/round_left_corner"
        android:drawablePadding="-10sp"/>

    <View android:layout_height="fill_parent"
        android:layout_width="1px"
        android:background="#90909090"
        android:layout_marginBottom="5dp"
        android:layout_marginTop="5dp"
        android:id="@+id/separator" />

    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        style="?android:attr/buttonBarButtonStyle"
        android:text="Login met Facebook"
        android:layout_weight="1"
        android:id="@+id/button2"
        android:textColor="#FFFFFF"
        android:drawableRight="@drawable/ic_action_forward"
        android:background="@drawable/round_right_corner"/>

</LinearLayout>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/linearLayout3"
    android:layout_marginTop="45dp"
    android:layout_alignRight="@+id/linearLayout3"
    android:layout_alignEnd="@+id/linearLayout3"
    android:id="@+id/linearLayout5">


    <Button
        android:layout_width="75dp"
        android:layout_height="wrap_content"
        style="?android:attr/buttonBarButtonStyle"
        android:id="@+id/button3"
        android:textColor="#FFFFFF"
        android:background="@drawable/round_left_corner"
        android:drawable="@drawable/ic_action_email"
        android:drawablePadding="-10sp"/>

    <View android:layout_height="fill_parent"
        android:layout_width="1px"
        android:background="#90909090"
        android:layout_marginBottom="5dp"
        android:layout_marginTop="5dp"
        android:id="@+id/separator2" />

    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        style="?android:attr/buttonBarButtonStyle"
        android:text="Login met E-Mail"
        android:layout_weight="1"
        android:id="@+id/button4"
        android:textColor="#FFFFFF"
        android:drawableRight="@drawable/ic_action_forward"
        android:background="@drawable/round_right_corner"/>

</LinearLayout>

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Registreer"
    android:id="@+id/button5"
    android:layout_below="@+id/linearLayout5"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginLeft="84dp" />

zak bennani
  • 31
  • 1
  • 8
  • You can refer this : http://stackoverflow.com/questions/4127725/how-can-i-remove-a-button-or-make-it-invisible-in-android – WannaBeGeek Sep 16 '14 at 12:44
  • Thanks Kanchan, however that is not really the problem i am facing. I want to put button 5 under button 3 but i don't see how do that in the text mode. In the design mode when i try to put one under another it doesn't work... – zak bennani Sep 16 '14 at 12:54
  • You can put things on top of other things with FrameLayout! https://www.google.es/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0CDoQFjAD&url=http%3A%2F%2Fwww.onlymobilepro.com%2F2012%2F05%2F22%2Fandroid-frame-layout-for-absolute-beginner%2F&ei=rDQYVJH7N4XxaLnigsAO&usg=AFQjCNFzAYenhTtTAyb0aikAaqO2BYRPyQ&sig2=XwNXEki3FmPl__HxEYXqRQ&cad=rja – eduyayo Sep 16 '14 at 13:02
  • You should probably include some pictures. – IAmGroot Sep 16 '14 at 13:13
  • Thanks guys i managed to sort it out – zak bennani Sep 17 '14 at 08:21

1 Answers1

0

</RelativeLayout> closing tag is missing in XML and you should use FrameLayout insted as mentioned by eduyayo. Documentation

Kushal Sharma
  • 5,978
  • 5
  • 25
  • 41