zoukankan      html  css  js  c++  java
  • NumberPicker设置宽度,设置文字颜色

    修改宽度

    wheel = (NumberPicker) findViewById(R.id.info_wheel_province);
    wheel.setLayoutParams(new LinearLayout.LayoutParams(deviceSize.x >> 1, LinearLayout.LayoutParams.WRAP_CONTENT));

    修改文字颜色

    public static boolean setNumberPickerTextColor(NumberPicker numberPicker, int color) {
            boolean result = false;
            final int count = numberPicker.getChildCount();
            for (int i = 0; i < count; i++) {
                View child = numberPicker.getChildAt(i);
                if (child instanceof EditText) {
                    try {
                        Field selectorWheelPaintField = numberPicker.getClass()
                                .getDeclaredField("mSelectorWheelPaint");
                        selectorWheelPaintField.setAccessible(true);
                        ((Paint) selectorWheelPaintField.get(numberPicker)).setColor(color);
                        ((EditText) child).setTextColor(color);
                        numberPicker.invalidate();
                        result = true;
                    } catch (NoSuchFieldException e) {
                        e.printStackTrace();
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (IllegalArgumentException e) {
                        e.printStackTrace();
                    }
                }
            }
            return result;
        }

    效果

  • 相关阅读:
    HUAS 1482 lsy的后宫(DP+矩阵快速幂)
    HUAS 1483 mex(离线+线段树)
    oracle 分页
    oracle 表查询(二)
    oracle 表查询(一)
    oracle 表的管理
    oracle 用户管理
    oracle sql*plus常用命令
    挑选数据库
    oracle sequence用法
  • 原文地址:https://www.cnblogs.com/xirtam/p/4696266.html
Copyright © 2011-2022 走看看