Java Code Examples for android.widget.NumberPicker#setLayoutParams()

The following examples show how to use android.widget.NumberPicker#setLayoutParams() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NumberPickerPreference.java    From a with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @return dialog view with picker inside
 */
@Override
protected View onCreateDialogView() {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER;

    numPicker = new NumberPicker(getContext());
    numPicker.setLayoutParams(layoutParams);
    numPicker.setMinValue(minValue);
    numPicker.setMaxValue(maxValue);

    FrameLayout dialogView = new FrameLayout(getContext());
    dialogView.addView(numPicker);

    return dialogView;
}
 
Example 2
Source File: NumberPickerPreference.java    From MyBookshelf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @return dialog view with picker inside
 */
@Override
protected View onCreateDialogView() {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER;

    numPicker = new NumberPicker(getContext());
    numPicker.setLayoutParams(layoutParams);
    numPicker.setMinValue(minValue);
    numPicker.setMaxValue(maxValue);

    FrameLayout dialogView = new FrameLayout(getContext());
    dialogView.addView(numPicker);

    return dialogView;
}
 
Example 3
Source File: NumberPickerPreference.java    From HaoReader with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @return dialog view with picker inside
 */
@Override
protected View onCreateDialogView() {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER;

    numPicker = new NumberPicker(getContext());
    numPicker.setLayoutParams(layoutParams);
    numPicker.setMinValue(minValue);
    numPicker.setMaxValue(maxValue);

    FrameLayout dialogView = new FrameLayout(getContext());
    dialogView.addView(numPicker);

    return dialogView;
}
 
Example 4
Source File: VNTNumberPickerPreference.java    From VNTNumberPickerPreference with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPrepareDialogBuilder(final Builder builder) {
    super.onPrepareDialogBuilder(builder);

    numberPicker = new NumberPicker(this.getContext());
    numberPicker.setMinValue(minValue);
    numberPicker.setMaxValue(maxValue);
    numberPicker.setValue(selectedValue);
    numberPicker.setWrapSelectorWheel(wrapSelectorWheel);
    numberPicker.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    final LinearLayout linearLayout = new LinearLayout(this.getContext());
    linearLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.addView(numberPicker);

    builder.setView(linearLayout);
}
 
Example 5
Source File: NumberPickerPreference.java    From grblcontroller with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected View onCreateDialogView() {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER;

    picker = new NumberPicker(getContext());
    picker.setLayoutParams(layoutParams);

    FrameLayout dialogView = new FrameLayout(getContext());
    dialogView.addView(picker);

    return dialogView;
}
 
Example 6
Source File: NumberPickerPreference.java    From fitnotifications with Apache License 2.0 5 votes vote down vote up
@Override
protected View onCreateDialogView() {
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER;
    layoutParams.weight = 1;

    picker = new NumberPicker(getContext());
    picker.setLayoutParams(layoutParams);

    beforeTV = new TextView(getContext());
    beforeTV.setText(beforeText);
    beforeTV.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18.0f);
    beforeTV.setPadding(0,20,0,0);
    beforeTV.setGravity(Gravity.END);
    beforeTV.setTypeface(Typeface.DEFAULT_BOLD);

    afterTV = new TextView(getContext());
    afterTV.setText(afterText);
    afterTV.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18.0f);
    afterTV.setPadding(0,0,0,20);
    afterTV.setGravity(Gravity.START);
    afterTV.setTypeface(Typeface.DEFAULT_BOLD);

    layoutParams.weight = 5;
    beforeTV.setLayoutParams(layoutParams);
    afterTV.setLayoutParams(layoutParams);

    LinearLayout dialogView = new LinearLayout(getContext());
    dialogView.setOrientation(LinearLayout.VERTICAL);
    dialogView.addView(beforeTV);
    dialogView.addView(picker);
    dialogView.addView(afterTV);

    return dialogView;
}
 
Example 7
Source File: NumberPickerPreference.java    From EasyVPN-Free with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected View onCreateDialogView() {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER;

    picker = new NumberPicker(getContext());
    picker.setLayoutParams(layoutParams);

    FrameLayout dialogView = new FrameLayout(getContext());
    dialogView.addView(picker);

    return dialogView;
}
 
Example 8
Source File: NumberPickerPreference.java    From comfortreader with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected View onCreateDialogView() {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER;

    picker = new NumberPicker(getContext());
    picker.setLayoutParams(layoutParams);

    FrameLayout dialogView = new FrameLayout(getContext());
    dialogView.addView(picker);

    return dialogView;
}
 
Example 9
Source File: PositionPickerPreference.java    From comfortreader with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected View onCreateDialogView() {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER;

    picker = new NumberPicker(getContext());
    picker.setLayoutParams(layoutParams);

    FrameLayout dialogView = new FrameLayout(getContext());
    dialogView.addView(picker);

    return dialogView;
}