Android Layout problemAt the certain part of screen, i sometimes need to display a button and sometimes a TextView -


this question has answer here:

at part of screen, need display button , textview. when button visible, textview invisible , vice-versa.(at same place). how can ?

this simple achieve. in layout have both button , textview in same place. make 1 of them visibile , hide other 1 using android:visibility="visible"/android:visibility="gone"

form code can hide , show accordingly them accordingly using

view.setvisibility(view.visible)  view.setvisibility(view.gone) 

something this:

<?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"     > <textview       android:layout_width="fill_parent"      android:layout_height="wrap_content"      android:text="@string/hello"     android:visibility="visible"     />  <button       android:layout_width="fill_parent"      android:layout_height="wrap_content"      android:visibility="gone"     />  </relativelayout> 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -