Issue
By default there is a text that comes up on a spinner control... .this text is the first value in the array that i have associated with the adapter for the spinner.
Upon selection this text changes to the value that i have selected.
I want to remove this text that appears on the spinner control. How do I go about it?
Solution
add new class
public class MySpinner extends Spinner {
private Context _context;
public MySpinner(Context context, AttributeSet attrs) {
super(context, attrs);
_context = context;
}
public MySpinner(Context context) {
super(context);
_context = context;
}
public MySpinner(Context context, AttributeSet attrs, int defStyle) {
super(context);
_context = context;
}
@Override
public View getChildAt(int index) {
View v = new View(_context);
return v;
}
}
in your layout
<[package].MySpinner android:id="@+id/Spinner01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Answered By - George
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.