Need Help By Creating A Dialog With 2 Numberpickers
I'm trying to create a dialog with 2 NumberPickers. I would like them to be default Holo theme styled. I cant find any good examples. So far i got: LayoutInflater inflater = (L
Solution 1:
I found the problem why my NumberPicker wasn't Holo.Light styled:
instead of calling:
LayoutInflaterinflater= (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ViewnpView= inflater.inflate(R.layout.number_picker_dialog, null);
i solved it by calling:
ViewnpView= getLayoutInflater().inflate(R.layout.number_picker_dialog, null);
Solution 2:
My approach was to create a Custom Dialog class as show below.
public class CustomDialog extends Dialog {
public CustomDialog(Context context) {
super(context, R.style.customDialog); //use your style id from styles.xml
}
public void setNumberDialog() {
setContentView(R.layout.number_picker_dialog);
//add required listenersshow();
}
}
Invoke the dialog from calling acitivty.
new CustomDialog(context).setNumberDialog();
And the style parameters are defined in styles.xml
<stylename="customDialog"parent="android:Theme.Dialog"><itemname="android:windowAnimationStyle">@android:style/Animation.Dialog</item><itemname="android:windowSoftInputMode">stateUnspecified|adjustPan</item><itemname="android:background">@android:color/transparent</item><itemname="android:textColor">@color/textColorWhite</item></style>
Solution 3:
Try :
<NumberPickerstyle="@android:style/TextAppearance"></NumberPicker>
Post a Comment for "Need Help By Creating A Dialog With 2 Numberpickers"