本文整理匯總了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);
}
示例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) {
}
}
}
}
示例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;
}
}
}
示例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;
}