Hello
This tutorial for bignner in android ..
i want to show you how to invisible a button in android using .java file here is your xml file
This tutorial for bignner in android ..
i want to show you how to invisible a button in android using .java file here is your xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF">
<Button android:text="Play"
android:id="@+id/play"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom = "true">
</Button>
<Button android:text="Stop "
android:id="@+id/stop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom = "true">
</Button>
</RelativeLayout> and here is your java file
playButton = (Button) findViewById(R.id.play);
playButton.setVisibility(1);
playButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//when play is clicked show stop button and hide play button
}
});
if you want want to programmatically show only one button at a time when its click event is called. here is the solution
playButton = (Button) findViewById(R.id.play);
playButton.setVisibility(1);
playButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//when play is clicked show stop button and hide play button
playButton.setVisibility(View.GONE);
stopButton.setVisibility(View.VISIBLE);
}
});
Thanks for today we will meet tomorrow with new topic
Thank you
No comments:
Post a Comment