আমার RelativeLayoutএকটিতে দুটি বোতাম রয়েছে। যা একে অপরের উপর আবৃত থাকে।
<?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>
আমি যখন ক্লিকের ইভেন্টটি কল করা হয় তখন প্রোগ্রামযুক্তভাবে শুধুমাত্র একটি বোতাম প্রদর্শন করতে চাই।
আমি এটি দিয়ে চেষ্টা করেছি:
playButton.setVisibility(1);
কিন্তু এটি কাজ করে না। নিম্নলিখিতটি আমি যা করার চেষ্টা করছি তার একটি উদাহরণ।
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
}
});