当前位置: 首页>>代码示例>>Java>>正文


Java NumberPicker.setLayoutParams方法代码示例

本文整理汇总了Java中android.widget.NumberPicker.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java NumberPicker.setLayoutParams方法的具体用法?Java NumberPicker.setLayoutParams怎么用?Java NumberPicker.setLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.NumberPicker的用法示例。


在下文中一共展示了NumberPicker.setLayoutParams方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateDialogView

import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
 *
 * @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;
}
 
开发者ID:leonardarnold,项目名称:NumberPickerPreference,代码行数:21,代码来源:NumberPickerPreference.java

示例2: onPrepareDialogBuilder

import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
protected void onPrepareDialogBuilder(final Builder builder) {
    super.onPrepareDialogBuilder(builder);
    mNumberPicker = new NumberPicker(getContext());
    mNumberPicker.setMinValue(mMinValue);
    mNumberPicker.setMaxValue(mMaxValue);
    mNumberPicker.setValue(mSelectedValue);
    mNumberPicker.setWrapSelectorWheel(mWrapSelectorWheel);
    mNumberPicker.setLayoutParams(new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    for (int i = 0; i < mNumberPicker.getChildCount(); i++) {
        View v = mNumberPicker.getChildAt(i);
        if (v instanceof EditText) {
            v.setOnKeyListener(new KeyListener());
        }
    }
    final LinearLayout linearLayout = new LinearLayout(this.getContext());
    linearLayout.setLayoutParams(new LinearLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.addView(mNumberPicker);

    builder.setView(linearLayout);
}
 
开发者ID:JackWink,项目名称:tweakable,代码行数:26,代码来源:NumberPickerPreference.java

示例3: createNumberPicker

import android.widget.NumberPicker; //导入方法依赖的package包/类
public NumberPicker createNumberPicker(final String[] names, final int level) {
    NumberPicker numberPicker = new NumberPicker(getContext());
    numberPicker.setTag(level);

    LinearLayout.LayoutParams params = new LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.leftMargin = 5;
    params.rightMargin = 5;

    numberPicker.setLayoutParams(params);
    numberPicker.setWrapSelectorWheel(true);
    numberPicker.setOnValueChangedListener(this);
    numberPicker.setMinValue(0);
    numberPicker.setMaxValue(names.length - 1);
    numberPicker.setDisplayedValues(names);

    return numberPicker;
}
 
开发者ID:LyndonChin,项目名称:AndroidAreaPicker,代码行数:19,代码来源:AreaPicker.java

示例4: onCreateDialogView

import android.widget.NumberPicker; //导入方法依赖的package包/类
@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;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:36,代码来源:NumberPickerPreference.java

示例5: onCreateDialogView

import android.widget.NumberPicker; //导入方法依赖的package包/类
@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;
}
 
开发者ID:gsantner,项目名称:memetastic,代码行数:14,代码来源:NumberPickerPreference.java

示例6: onCreateDialogView

import android.widget.NumberPicker; //导入方法依赖的package包/类
@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;
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:12,代码来源:NumberPickerPreference.java

示例7: onCreateDialogView

import android.widget.NumberPicker; //导入方法依赖的package包/类
@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;
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-werewolf,代码行数:15,代码来源:NumberPickerPreference.java

示例8: onCreateDialogView

import android.widget.NumberPicker; //导入方法依赖的package包/类
@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;
}
 
开发者ID:lidox,项目名称:reaction-test,代码行数:15,代码来源:NumberPickerPreference.java

示例9: onCreateDialogView

import android.widget.NumberPicker; //导入方法依赖的package包/类
@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;
}
 
开发者ID:dhasenfratz,项目名称:hRouting_Android,代码行数:16,代码来源:NumberPickerPreference.java

示例10: resizeNumberPicker

import android.widget.NumberPicker; //导入方法依赖的package包/类
private void resizeNumberPicker(NumberPicker np){
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    np.setLayoutParams(params);
}
 
开发者ID:yun2win,项目名称:yun2win-sdk-android,代码行数:5,代码来源:ChooseDateDialog.java

示例11: onPreferenceClick

import android.widget.NumberPicker; //导入方法依赖的package包/类
@Override
public boolean onPreferenceClick(final Preference preference) {
    int maxValue;

    switch (preference.getKey()) {
        case "connection_timeout":
            maxValue = 180;
            break;
        case "one_request_limit":
            maxValue = 15000;
            break;
        case "notify_fire_duration":
            maxValue = 10080;
            break;
        case "carbon_limit":
            maxValue = 5000;
            break;
        default:
            maxValue = 42;
            break;
    }

    int value = preference.getSharedPreferences().getInt(preference.getKey(), 1);

    final NumberPicker picker = new NumberPicker(getContext());
    picker.setMinValue(1);
    picker.setMaxValue(maxValue);
    picker.setValue(value);
    picker.setWrapSelectorWheel(false);
    picker.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));

    final LinearLayout linearLayout = new LinearLayout(getActivity());
    linearLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.addView(picker);

    new AlertDialog.Builder(getContext())
            .setTitle(preference.getTitle())
            .setView(linearLayout)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    picker.clearFocus();
                    int newValue = picker.getValue();
                    SharedPreferences.Editor editor = preference.getSharedPreferences().edit();
                    editor.putInt(preference.getKey(), newValue);
                    editor.apply();
                }
            })
            .setNegativeButton(android.R.string.cancel, null)
            .show();

    return true;
}
 
开发者ID:vit1-irk,项目名称:idec-mobile,代码行数:55,代码来源:SettingsFragment.java


注:本文中的android.widget.NumberPicker.setLayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。