Android Tutorial & Lessons 15: Program our RadioGroup to change style and gravity
Uploader Comments (CornboyzAndroid)
All Comments (18)
-
Thanks, man! You are awesome! You are really explaining it, so that everybody can understand! Thumbs up!
-
Just from watching your videos, I have ascended. You are the master.
-
many thanks bro, keep going.
-
Thanks for these supporting vedios, but by some reason
textOut.setGravity(Gravity.LEF
T); textOut.setTypeface(Typeface.d
efaultFromStyle(Typeface.NORMA L)); are not responding but this is responsing..
textOut.setText("Center");
Again thanks for these vedios...
-
Hmm you can just add null argument on style, I mean typeface.
So you don't need to add Typeface.defaultFromStyle. Also don't need at the end ,Typeface.ITALIC again. Work perfect just with first parameter null.
Probably like this:
textOut.setTypeface(null, Typeface.ITALIC);
and for others
textOut.setTypeface(null, Typeface.NORMAL);
textOut.setTypeface(null, Typeface.BOLD);
-
I'm not sure if this is correct, but I think it means that since OnCheckedChange is in a dif. class, we can't "see" it in our Tutorial1 class (probably bc this event handler is either not public or in a class thats not public...idk) but anyway. I think it just sets up the event handler for u...Remember in the button examples, Eclipse created a new OnClicked function for us? Well this is kinda the same thing...I think. lol.
-
I'm not sure if this is correct, but I think it means that since OnCheckedChange is in a dif. class, we can't "see" it in our Tutorial1 class (probably bc this event handler is either not public or in a class thats not public...idk) but anyway. I think it just sets up the event handler for u...Remember in the button eclipse created a new OnClicked function for us? Well this is kinda the same thing...I think. lol.
-
@CornboyzAndroid i suggest you'll create a new method that returns that listener, it's much more clean that way.
Travis.. Assume the Left "Gravity" radio button and Normal "Style" radio button are both initially check (ie, android:checked="true") in the layout setup. How does the "switch" logic recognize both initially checked buttons in tutorialOne.java when the first checked button causes the system to "break"? The reason I ask is because I like to initialize all radio group buttons when a screen is first presented to a user.
dutch345 1 year ago
@dutch345 they way we set it up wouldn't recognize it. if however you want to set up an initial selection you could set it up the variable that changes within the onCreate method. for example you could set up textOut.setGravity(Gravity.CENTER); within the onCreate method if you initialize the center radio button checked to true. That's a basic way to accomplish what you are looking for
CornboyzAndroid 1 year ago
Hi!
Nice tuts. But u got some confusion about the "this" and "implements".
The "this" in this case is pointing to the actual class tutorialOne. (like you could type this.textOut and it would work)
Since you set tutorialOne as a listener, it have to implement the oncheckedchangelistener interface wich is a litlebit different than a class.
The main difference is that when u implement from an interface you have to implement its methotds, in this case onCheckedChange(RadioGroup goup,int checkedId).
themobius 1 year ago 3
@themobius Hey man, Thanks for the input!
CornboyzAndroid 1 year ago