Android 如何获取系统字体大小

2019-05-21 14:50:57


public static float getFontSize() {

        Configuration mCurConfig = new Configuration();

        try {

            mCurConfig.updateFrom(ActivityManagerNative.getDefault().getConfiguration());

        } catch (RemoteException e) {

            Log.w(TAG, "Unable to retrieve font size");

        }

 

        Log.w(TAG, "getFontSize(), Font size is " + mCurConfig.fontScale);

        return mCurConfig.fontScale;

 

    }


  • 2019-10-11 13:48:00

    关于Integer比较相等的问题

    原来两个Integer类型的数字不能用==来判断,要用equal 不过Integer类型的可以与1,2这样的纯数字来判断