I'm making a program that change the color of the background, for example, when I press white, change background to white, black to black, and so on... and after have pressed a button the others disappear and I have already done that but what I want to do is that each tap on the Textview the buttons appear/disappear. how can I do this?
this is my code
LinearLayout myLayout;
LinearLayout myLayout2;
// Declare UI elements
private Button firstButton;
private Button secondButton, thirdButton;
// private ImageView changeBackground;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
myLayout = (LinearLayout) findViewById(R.id.myLayout);
myLayout2 = (LinearLayout) findViewById(R.id.myLayout2);
// Initialize the UI components
firstButton = (Button) findViewById(R.id.button1);
// When we creating a button and if we expect that to use for event handling we have to set the listener
firstButton.setOnClickListener(this);
secondButton = (Button) findViewById(R.id.button2);
secondButton.setOnClickListener(this);
thirdButton = (Button) findViewById(R.id.button3);
thirdButton.setOnClickListener(this);
}
#Override
public void onClick(View v) { // Parameter v stands for the view that was clicked.
switch(v.getId()) {
case R.id.button1:
myLayout.setBackgroundColor(Color.WHITE);
myLayout2.setVisibility(View.INVISIBLE);
break;
case R.id.button2:
myLayout.setBackgroundColor(Color.BLACK);
myLayout2.setVisibility(View.INVISIBLE);
break;
case R.id.button3:
myLayout.setBackgroundColor(Color.RED);
myLayout2.setVisibility(View.INVISIBLE);
break;
}
}
the xml
<LinearLayout 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:orientation="vertical"
android:background="#A9F5F2"
android:id="#+id/myLayout"
tools:context=".MainActivity" >
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="#string/hello_world" />
<LinearLayout
android:id="#+id/myLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#D8D8D8"
android:orientation="horizontal"
android:gravity="center"
tools:context=".MainActivity" >
<Button
android:id="#+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/white" />
<Button
android:id="#+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/button1"
android:layout_alignBottom="#+id/button1"
android:layout_toRightOf="#+id/button1"
android:text="#string/black" />
<Button
android:id="#+id/button3"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/button2"
android:layout_alignBottom="#+id/button2"
android:layout_toRightOf="#+id/button2"
android:text="#string/red" />
</LinearLayout>
</LinearLayout>
Try this
myLayout.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v){
myLayout2.setVisibility(View.VISIBLE);
}
});
and change this:
myLayout2.setVisibility(View.INVISIBLE);
to:
myLayout2.setVisibility(View.GONE);
Just to explain why you need to use GONE instead of INVISIBLE, if you set the visibility to INVISIBLE the object will continue to alter to exist in the screen, you just can't see the object... and when you use GONE the object doesn't exist on the screen but exist in the app instance.
If you want your button to disappear with all his characteristics use :
myLayout2.setVisibility(View.GONE);
instead of
myLayout2.setVisibility(View.INVISIBLE);
INVISIBLE:
This view is invisible, but it still takes up space for layout purposes.
GONE:
This view is invisible, and it doesn't take any space for layout purposes.
Related
I created an empty activity in my Android project, and added one TextView and one Button to it, like so:
<?xml version="1.0" encoding="utf-8"?>
<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:layout_margin="10dp"
android:onClick="onClick"
tools:context="com.radical.pillbox.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/CloseActivityCross"
android:text="#string/cross"
android:textSize="50sp"
android:padding="10dp"
android:fontFamily="#font/montserrat_bold"
android:textColor="#color/pillbox_green_primary_dark" />
<TextView
android:id="#+id/IntroString"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/CloseActivityCross"
android:fontFamily="#font/montserrat_light"
android:padding="10dp"
android:text="Welcome to Pillbox."
android:textColor="#000000"
android:textSize="30sp"
android:gravity="left"
android:textAlignment="gravity"/>
<EditText
android:id="#+id/EmailEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/IntroString"
android:layout_marginLeft="10dp"
android:alpha="0.64"
android:fontFamily="#font/montserrat_light"
android:hint="email#example.com"
android:inputType="textEmailAddress"
android:textColor="#color/pillbox_background_dark"
android:textColorHint="#color/pillbox_accent_green" />
<EditText
android:id="#+id/PasswordEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/EmailEditText"
android:layout_marginStart="10dp"
android:alpha="0.64"
android:fontFamily="#font/montserrat_light"
android:hint="password"
android:inputType="textPassword"
android:textColor="#color/pillbox_background_dark"
android:textColorHint="#color/pillbox_accent_green" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/FooterString"
android:textColor="#000000"
android:textSize="12sp"
android:text="2018."
android:layout_centerHorizontal="true"
android:textAlignment="center"
android:fontFamily="#font/montserrat_light"
android:layout_alignParentBottom="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:id="#+id/SignInButton"
android:background="#drawable/round_button"
android:text="Sign In"
android:textSize="15sp"
android:textColor="#color/pillbox_green_primary_dark"
android:layout_below="#id/PasswordEditText"/>
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:id="#+id/SignUpButton"
android:background="#drawable/round_button"
android:text="Sign Up"
android:textSize="15sp"
android:textColor="#color/pillbox_green_primary_dark"
android:layout_below="#id/PasswordEditText"
android:layout_toRightOf="#id/SignInButton"/>
</RelativeLayout>
My MainActivity.java file is:
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText email = (EditText) findViewById(R.id.EmailEditText);
EditText password = (EditText) findViewById(R.id.PasswordEditText);
TextView close = (TextView) findViewById(R.id.CloseActivityCross);
Button sign_up = (Button) findViewById(R.id.SignUpButton);
Button sign_in = (Button) findViewById(R.id.SignInButton);
email.setOnClickListener(MainActivity.this);
password.setOnClickListener(MainActivity.this);
sign_in.setOnClickListener(MainActivity.this);
close.setOnClickListener(MainActivity.this);
}
#Override
public void onClick(View view) {
EditText email = (EditText) findViewById(R.id.EmailEditText);
EditText password = (EditText) findViewById(R.id.PasswordEditText);
TextView close = (TextView) findViewById(R.id.CloseActivityCross);
Button sign_up = (Button) findViewById(R.id.SignUpButton);
Button sign_in = (Button) findViewById(R.id.SignInButton);
switch (view.getId()) {
case (R.id.SignInButton):
Log.d("Event:", "Signed in with correct credentials.");
break;
case (R.id.CloseActivityCross):
Toast.makeText(MainActivity.this, "Closing.", Toast.LENGTH_SHORT).show();
MainActivity.this.finish();
Log.d("Cross:", "Activity closed");
break;
}
}
}
In my main activity, I created cases in a switch-statement to handle the OnClick Events, but only the first case defined works. The remaining cases never trigger for some reason or trigger after an extended delay. To diagnose where the problem occurs, I have:
1. Tried to change the order in which I add the listeners
2. Changed cases with the first being CloseActivityCross once and SignInButton the next. Each time, only the first case works properly. Why does this happen? I should mention that in one trial, things began working perfectly for a while, and now the same issue is cropping up.
Don't re-initialize your views in onClick method i.e., remove these lines from the OnClick method and it should be good.
EditText email = (EditText) findViewById(R.id.EmailEditText);
EditText password = (EditText) findViewById(R.id.PasswordEditText);
TextView close = (TextView) findViewById(CloseActivityCross);
Button sign_up = (Button) findViewById(R.id.SignUpButton);
Button sign_in = (Button) findViewById(R.id.SignInButton);
what's happening is, when you press any of these views, they lose their onClickListeners as you are initializing the above views again.
Edited as OP added additional code.
EDIT 2:
Remove OnClick for root element RelativeLayout
<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:layout_margin="10dp"
tools:context="com.radical.pillbox.MainActivity">
Listeners are OK in java code . The problem is in xml . Your parent layout is RelativeLayout and you have use rule android:layout_below .
In some places you have used "#id instead of "#+id . So this will make overlap the views . Make it write as "#+id in all android:layout_below tags and remove android:onClick="onClick" from root layout . see if it works .
Suggestion :- If all of your widgets aligned vertically then Use LinearLayout with vertical orientation .
I am using view switcher in my project.
In my xml I have created 2 layouts with all same Id's.
After I switch my view I can not switch to previous view because I am using same ID's in both layouts.
Now how can I use one listener in java code for both layouts in view switcher.
I dont want to create an another id and create another listener to switch again.
My xml is as below.
<ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/profileSwitcher"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="#string/hello_world" />
<Button
android:id="#+id/switchBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Switch" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="#string/hello_world" />
<Button
android:id="#+id/switchBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Switch" />
</RelativeLayout>
</ViewSwitcher>
My java code is as follows
final ViewSwitcher switcher = (ViewSwitcher) findViewById(R.id.profileSwitcher);
Button btn = (Button) findViewById(R.id.switchBtn);
btn.setOnClickListener(new OnClickListener() {
private boolean switchCheck;
public void onClick(View v) {
new AnimationUtils();
switcher.setAnimation(AnimationUtils.makeInAnimation(getApplicationContext(), true));
if (!switchCheck) {
switcher.showNext();
switchCheck = true;
} else {
switcher.showPrevious();
switchCheck = false;
}
}
});
Please help..
Crete different ids for parent relative layout in xml.
And then in java file check which relative layout button is used.
using method
step 1)
RelativeLayout r1 = RelativeLayout findviewbyId(R.id.rl1)
RelativeLayout r2 = RelativeLayout findviewbyId(R.id.rl2)
step2)
if button.getParent equals to R1 then ...
else .....
Just try to change ur text in any of the button or textView .may be ur view is switching but because the code for both the layouts is exactly same u r not able to differentiate.
I am new to android and i am unable to solve my simple problem.I have a parent Tablelayout and inside it i have two tablelayouts with ids tbl1 and tbl2 respectively in my xml file.In tbl1 layout i have three textviews and three edittext controls similarly i have some views in tbl2 layout.Now i want that my tbl1 layout is visible when my activity starts but on click of my button2 which is in tbl1 layout my tablelayout tbl1 gets invisible and my tablelayout tbl2 becomes visible.Actually i know i can achieve this in asp.net with the help of panels but in android i am not able to achieve the same thing.Please help
You are going to want to look at the setVisibility() method. In the on click listeners for button 2, put the following;
Button.setVisibility(View.INVISIBLE)
TextView.setVisibility(View.INVISIBLE)
etc...
This will make the views invisible, but they will still take up space. If you don't want them to take up space you should use
setVisibility(Veiw.GONE);
Finally, to make you buttons and textview and edittexts in the second table, appear, you need to do the following;
setVisibility(View.VISIBLE);
Java Code:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.visibility_1);
// Find the view whose visibility will change
mVictim = findViewById(R.id.victim);
// Find our buttons
Button visibleButton = (Button) findViewById(R.id.vis);
Button invisibleButton = (Button) findViewById(R.id.invis);
Button goneButton = (Button) findViewById(R.id.gone);
// Wire each button to a click listener
visibleButton.setOnClickListener(mVisibleListener);
invisibleButton.setOnClickListener(mInvisibleListener);
goneButton.setOnClickListener(mGoneListener);
}
OnClickListener mVisibleListener = new OnClickListener() {
public void onClick(View v) {
mVictim.setVisibility(View.VISIBLE);
}
};
OnClickListener mInvisibleListener = new OnClickListener() {
public void onClick(View v) {
mVictim.setVisibility(View.INVISIBLE);
}
};
OnClickListener mGoneListener = new OnClickListener() {
public void onClick(View v) {
mVictim.setVisibility(View.GONE);
}
};
}
XML Code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:background="#drawable/box"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:background="#drawable/red"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/visibility_1_view_1"/>
<TextView android:id="#+id/victim"
android:background="#drawable/green"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/visibility_1_view_2"/>
<TextView
android:background="#drawable/blue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/visibility_1_view_3"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button android:id="#+id/vis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/visibility_1_vis"/>
<Button android:id="#+id/invis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/visibility_1_invis"/>
<Button android:id="#+id/gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/visibility_1_gone"/>
</LinearLayout>
</LinearLayout>
I have an app, which shows toast below the actionbar. I'm using Crouton library for displaying toast. Here I'm placing custom layout for toast, that layout contains one textview and one button (for close option). So Toast appears with button. If I click that it should close the toast but nothing happens.. Below Code for this example. Any Help Appreciated
MainActivity.java
public class MainActivity extends SherlockActivity implements OnClickListener {
private View customToastView;
private TextView customToastMessageView;
private Button customToastCloseButton;
private Button doneButton;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
doneButton = (Button) findViewById(R.id.done_button);
customToastView = getLayoutInflater().inflate(R.layout.toast_custom_layout, null);
customToastMessageView = (TextView) customToastView.findViewById(R.id.messages);
customToastCloseButton = (Button) customToastView.findViewById(R.id.close_button);
customToastCloseButton.setOnClickListener(this);
doneButton.setOnClickListener(this);
}
#Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.done_button:
Crouton.cancelAllCroutons();
customToastMessageView.setText("Message");
Crouton.show(this, customToastView);
break;
case R.id.close_button:
Crouton.cancelAllCroutons();
break;
}
}
}
toast_custom_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/messages"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="26dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="#+id/close_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="23dp"
android:text="Button" />
</RelativeLayout>
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="#+id/done_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="146dp"
android:text="Button" />
</RelativeLayout>
I am new to animations. I have a spin Animation on a button. The problem is when that button animation is executed the button intersects other buttons in the layout. So during animation the moving button cannot be seen since it is being covered up by other buttons. Any idea on how to make my animation stay on the top layer of the layout? I would like to figure out a solution that is API 8 compatible.
//create shake animation
final Animation shakeIt = AnimationUtils.loadAnimation(this, R.anim.shake);
findViewById(R.id.button_spin).startAnimation(shakeIt);
// use shake animation
spinnerButton.startAnimation(shakeIt);
EDIT: (here is a lot more info)
So i have played with it over the past few hours and discovered some more things. Lecho intuition is correct, the z order is the driving factor in whether a widget goes "above" or "below" another one. The problem I am facing is could be because of two things:
The button that is at the front of view view (and i want to move it back) has text that is edited near the end of the activity. Does adding text forcing the widget to redraw change the Z order of that view???
The button text is changed in the onResume() and it seems that I'm not able to change the Z-order of the buttons in that method???
answers to these above 2 questions would solve my problem
Edit 2: XML in question
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/bg"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight=".7"
android:layout_marginTop="5dp" >
<Button
android:id="#+id/categoryButton"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/drop"
android:prompt="#string/planet_prompt"
android:paddingRight="20dp"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="35dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1.5" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="1" >
</LinearLayout>
<Button
android:id="#+id/button_spin"
android:layout_width="0dp"
android:layout_weight="2.35"
android:layout_height="fill_parent"
android:background="#drawable/letseat"
android:layout_gravity="center_horizontal"
android:gravity="center" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="1" >
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="vertical">
<Button
android:id="#+id/button_additems"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="#drawable/add_rest"
android:gravity="center_horizontal" />
<Button
android:id="#+id/button_showrestaurant"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="#drawable/edit_rest"
android:gravity="center_horizontal" />
<Button
android:id="#+id/button_nearbyplaces"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="#drawable/whats_near"
android:gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>
Just my idea. In android z-order is determined by order in which views are added to XML. Maybe animated button was added to xml before the other one so it is "deeper". Try to put animated button later in XML or use method bringChildToFront(buttonView) on your layout or add your button to layout from code.
Edit:
Ad 1. Adding text seems to not change the Z order. When I change text and call button.bringToFront() the Z order is changed but not when I call bringToFront() or setText() alone.
Ad 2. In onResume adding text doesn't change Z order but method bringToFront() seems to works as expected.
I am not able to test those methods together with view animation right now.
Test activity:
public class MainActivity extends Activity {
private int i = 1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button btn1 = (Button) findViewById(R.id.btn1);
final Button btn2 = (Button) findViewById(R.id.btn2);
btn2.bringToFront();
final Button btn3 = (Button) findViewById(R.id.btn3);
btn3.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if ((i % 2) == 0) {
final Button btn1 = (Button) findViewById(R.id.btn1);
btn1.setText("BUTTON_BLACK_NEW");
btn1.bringToFront();
} else {
final Button btn2 = (Button) findViewById(R.id.btn2);
btn2.setText("BUTTON_GREY_NEW");
btn2.bringToFront();
}
++i;
}
});
}
#Override
protected void onResume() {
super.onResume();
if ((i % 2) == 0) {
final Button btn1 = (Button) findViewById(R.id.btn1);
btn1.bringToFront();
} else {
final Button btn2 = (Button) findViewById(R.id.btn2);
btn2.bringToFront();
}
++i;
}
}
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"
android:id="#+id/main_layout">
<Button
android:id="#+id/btn1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/black"
android:text="BUTTON_BLACK"
android:textColor="#android:color/white" />
<Button
android:id="#+id/btn2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/darker_gray"
android:text="BUTTON_GREY"
android:textColor="#android:color/black" />
<Button
android:id="#+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CHANGE_Z"
android:layout_below="#+id/btn2" />
</RelativeLayout>