Hi, I am a new Android developer and i have a problem with buttons and styles.
I have to create buttons with java code and I want set a specific style. My code: in values directory --> styles.xml <?xml version="1.0" encoding="utf-8"?> <resources> <style name="ButtonText"> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:gravity">center_vertical</item> <item name="android:layout_margin">3dp</item> <item name="android:textColor">#303a39</item> <item name="android:shadowColor">#8a9493</item> <item name="android:shadowDx">1</item> <item name="android:shadowDy">1</item> <item name="android:shadowRadius">2</item> <item name="android:drawableRight">@drawable/icon_button</item> </style> </resources> in Activity I have private void generateButtons(){ LinearLayout layout = (LinearLayout) findViewById(R.id.contentLayout); Iterator<Language> itr = languages.iterator(); while (itr.hasNext()) { Language l = itr.next(); Button createButton = new Button(this,null,R.style.ButtonText); createButton.setId(l.getId()); createButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.button)); createButton.setText(l.getName()); layout.addView(createButton); } } In construct I pass the button style but it doesn't work. Any idea? Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en