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


Java NumberPicker.getChildCount方法代码示例

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


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

示例1: 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

示例2: updateTextAttributesForNumberPicker

import android.widget.NumberPicker; //导入方法依赖的package包/类
static void updateTextAttributesForNumberPicker(NumberPicker picker, /*int textColor,*/ int textSizeSP) {
    for (int i = 0; i < picker.getChildCount(); i++){
        View child = picker.getChildAt(i);
        if (child instanceof EditText) {
            try {
                Field selectorWheelPaintField = NumberPicker.class.getDeclaredField("mSelectorWheelPaint");
                selectorWheelPaintField.setAccessible(true);

                Paint wheelPaint = ((Paint)selectorWheelPaintField.get(picker));
                //wheelPaint.setColor(textColor);
                wheelPaint.setTextSize(spToPixels(picker.getContext(), textSizeSP));

                EditText editText = ((EditText) child);
                //editText.setTextColor(textColor);
                editText.setTextSize(textSizeSP);

                picker.invalidate();
                break;
            }
            catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException ignored) {
            }
        }
    }
}
 
开发者ID:henrichg,项目名称:PhoneProfilesPlus,代码行数:25,代码来源:GlobalGUIRoutines.java

示例3: enableNumberPickerEditing

import android.widget.NumberPicker; //导入方法依赖的package包/类
/**
 * Enable or disable NumberPicker editing. We use this to turn
 * off editing and this has the effect of removing the blinking
 * cursor that is shown by default.
 */
private void enableNumberPickerEditing(NumberPicker numberPicker, boolean enable)
{
    int childCount = numberPicker.getChildCount();

    for (int i = 0; i < childCount; i++)
    {
        View childView = numberPicker.getChildAt(i);

        if (childView instanceof EditText)
        {
            EditText editText = (EditText) childView;
            editText.setFocusable(enable);
            return;
        }
    }
}
 
开发者ID:jjobes,项目名称:SlideDayTimePicker,代码行数:22,代码来源:DayFragment.java

示例4: getChildCount

import android.widget.NumberPicker; //导入方法依赖的package包/类
public static int getChildCount(NumberPicker np) {
    try {
        if (VERSION.SDK_INT >= 11) {
            return np.getChildCount();
        }
    } catch (Throwable e) {
        LOG.w(TAG, "get child count failed(Throwable): " + e.getMessage());
    }
    return 0;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:11,代码来源:SDKUtils.java


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