search

Home  >  Q&A  >  body text

layout - Android studio开发app时, values-w820dp文件夹是什么意思?

820dp是指屏幕分辨率还是尺寸大小什么的?比如Samsung G920V手机符合820dp吗?

巴扎黑巴扎黑2889 days ago711

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 17:52:46

    1. values-w820dp indicates that the minimum width of the screen required by the resources in this directory is 820dp.

    2. I searched the screen configuration parameters of Samsung G920V: 1440x2560 pixels, screen size 5.1 inches, dpi=576. Therefore, the minimum screen width of Samsung G920V is: 400dp (1440 * 160 / 576), so it does not meet the requirements of w820dp.

    For more knowledge, you can refer to the official Android documentation: https://developer.android.com..., I am currently translating it, and a link will be given after the translation is completed.

    It took a week and the translation was finally completed. Chinese link: http://blog.csdn.net/wzy_1988...

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 17:52:46

    Devices with a screen width of 820dp and above call resource files in this directory. dp is a relative size, which can be obtained by screen width ÷ screen pixel density
    Screen width
    public static int getScreenWidth(Activity activity){

        DisplayMetrics metric = new DisplayMetrics();
        activity.getWindowManager().getDefaultDisplay().getMetrics(metric);
        int width=metric.widthPixels;
        return width;
    }
    屏幕像素密度
     public  static float getScreenDensity(Activity activity){
        DisplayMetrics metric = new DisplayMetrics();
        activity.getWindowManager().getDefaultDisplay().getMetrics(metric);
        float density = metric.density;
        return density;
    }
    

    reply
    0
  • Cancelreply