Set button visibility to GONE (button will be completely "removed" -- the buttons space will be available for another widgets) or INVISIBLE (button will became "transparent" -- its space will not be available for another widgets):
View b = findViewById(R.id.button);
b.setVisibility(View.GONE);
or in xml:<Button ... android:visibility="gone"/>
Or
First make the button invisible in xml file.Then set button visible in java code if needed.
Button resetButton=(Button)findViewById(R.id.my_button_del);
resetButton.setVisibility(0); //To set visible
Xml:<Button
android:text="Delete"
android:id="@+id/my_button_del"
android:layout_width="72dp" android:layout_height="40dp"
android:visibility="invisible"/>
Không có nhận xét nào:
Đăng nhận xét