android - configure Button programmatically doesn't work -


i go button:

<button             android:id="@+id/dialog_menu_topic"             style="@style/dialog_menu_topic"/> 

with style reference:

<style name="dialog_menu_topic">     <item name="android:layout_width">wrap_content</item>     <item name="android:layout_height">wrap_content</item>     <item name="android:layout_alignparentright">true</item>     <item name="android:layout_alignparenttop">true</item>     <item name="android:text">@string/menu_button</item>     <item name="android:onclick">menubuttonclicked</item>     <item name="android:visibility">visible</item> 

this activity declared dialog:

<style name="dialog_style" parent="@android:style/theme.dialog">     <item name="android:windownotitle">true</item> 

and if do:

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.myactivity);          button menubutton = (button) findviewbyid(r.id.dialog_menu_topic);         menubutton.setvisibility(button.gone); } 

nothing happens. tried getting layoutparams, add rule set visibility gone , set params button. button showing again , again. appreciated.

the app isn't crashing , button isn't hiding should do. attention: style , id of button got same name, @ different location, can have same name that's not problem! appreciated.

update button.setvisibility(int value) needs integer. both button , view.gone returning same integer.. that's not problem , yes tried view.gone, not necessary...:

11-27 14:56:24.538: e/button id button.gone(27826): 8 11-27 14:56:24.538: e/view id view.gone(27826): 8 

logcat output of view.gone und button.gone...

update when use onclick method of button setvisibility works!:

public void myonclickfrommenubutton(view v){     v.setvisibility(view.gone); } 

but if use @ normal oncreate-method like:

view mybuttonview = (view) findviewbyid(r.id.dialog_menu_topic); mybuttonview.setvisibility(view.gone); 

again nothing happens.... it's bad joke... ;//

update menubutton setvisibility gone , view v onclick method have same id:

11-27 18:48:56.867: e/menubutton.getid(12417): 2131361795 11-27 18:49:00.850: e/v getid(12417): 2131361795 

from v button disapears in normal oncreate won't! please need help..

try

 menubutton.setvisibility(view.gone); 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -