當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。