取drawable 里面的图片数组用法
例如你有flag1...flag10.png在drawable里面可以这样读到数组里面
- var Drawable[] dw = new Drawable[10];
- for (int i = 1; i <= 10; i++) {
- int id = getResources().getIdentifier(
- "flag" + i,
- "drawable", getPackageName());
- dw[i-1] = getResources().getDrawable(id);
- }
activity 可以直接getWindowManager()
如果只有context,可以WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
然后WindowManager.getDefaultDisplay()
int getHeight()
int getOrientation()
int getPixelFormat()
float getRefreshRate()
int getWidth()
void getMetrics(DisplayMetrics outMetrics)