Reputation: 598
really Basic question but i can't get the Point.
I have a Button with an onclicklistener and following style:
<style name="dialog_button_scale">
<item name="android:layout_width">@dimen/dialog_button_scale_width</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_alignParentTop">true</item>
<item name="android:layout_toLeftOf">@id/dialog_button_sort</item>
<item name="android:text">medium</item>
<item name="android:textColor">@color/Black</item>
<item name="android:onClick">imagebtnPerRow</item>
for testing i simple tried:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myActivity);
Button myBtn = (Button) findViewById(R.id.dialog_button_scale);
myBtn.setText("large");
myBtn.setTextColor(Color.parseColor("#FFFFFF"));
}
But nothing changes... Any suggestions?
Upgrade Please, before Upvoting an answere:
<Button
android:id="@+id/dialog_button_scale"
style="@style/dialog_button_scale" />
Both names are the same, but one for style and one for id..
Sorry for confusing you guys..
Update2 in my OnClick method i Change the text for example from medium to large and later i get the Text from the button and it is large but the UI isn't updating!
Upvotes: 0
Views: 1941
Reputation: 2327
In Button myBtn = (Button) findViewById(R.id.dialog_button_scale); You are getting the style name instead of the Button @id of the xml layout.
Upvotes: 2