当前位置: 编程技术>移动开发
本页文章导读:
▪Pthread的相干资料 Pthread的相关资料
最近在看一些framework层的c++代码。会遇到AutoMutex,浏览了一下其源码,知道是pthread,就先把pthread的相关知识收集,方便以后学习它:https://computing.llnl.gov/tutorials/pthreads/#Pth.........
▪ 利用DisplayMetrics获取银屏信息 利用DisplayMetrics获取屏幕信息
public static String getDisplayMetrics(Context cx) {
String str = "";
DisplayMetrics dm = new DisplayMetrics();
//取得DisplayMetrics对象方法一
//dm = cx.getApplication.........
▪ 批改dialog的大小 修改dialog的大小
1.在manifest.xml中activity添加android:theme="@android:style/Theme.Dialog"2.WindowManager m = getWindowManager();Display d = m.getDefaultDisplay(); //为获取屏幕宽、高LayoutParams p = getWindow().getAttributes(); .........
[1]Pthread的相干资料
来源: 互联网 发布时间: 2014-02-18
Pthread的相关资料
最近在看一些framework层的c++代码。会遇到AutoMutex,浏览了一下其源码,知道是pthread,就先把pthread的相关知识收集,方便以后学习它:
https://computing.llnl.gov/tutorials/pthreads/#PthreadsAPI
http://linux.sheup.com/linux/linux5115.htm
http://blogold.chinaunix.net/u3/111328/showart_2526774.html
最近在看一些framework层的c++代码。会遇到AutoMutex,浏览了一下其源码,知道是pthread,就先把pthread的相关知识收集,方便以后学习它:
https://computing.llnl.gov/tutorials/pthreads/#PthreadsAPI
http://linux.sheup.com/linux/linux5115.htm
http://blogold.chinaunix.net/u3/111328/showart_2526774.html
[2] 利用DisplayMetrics获取银屏信息
来源: 互联网 发布时间: 2014-02-18
利用DisplayMetrics获取屏幕信息
public static String getDisplayMetrics(Context cx) { String str = ""; DisplayMetrics dm = new DisplayMetrics(); //取得DisplayMetrics对象方法一 //dm = cx.getApplicationContext().getResources().getDisplayMetrics(); //取得DisplayMetrics对象方法二 ((Activity)cx).getWindowManager().getDefaultDisplay().getMetrics(dm); int screenWidth = dm.widthPixels; int screenHeight = dm.heightPixels; float density = dm.density; float xdpi = dm.xdpi; float ydpi = dm.ydpi; str += "The absolute width:" + String.valueOf(screenWidth) + "pixels\n"; str += "The absolute heightin:" + String.valueOf(screenHeight) + "pixels\n"; str += "The logical density of the display.:" + String.valueOf(density) + "\n"; str += "X dimension :" + String.valueOf(xdpi) + "pixels per inch\n"; str += "Y dimension :" + String.valueOf(ydpi) + "pixels per inch\n"; return str; }
[3] 批改dialog的大小
来源: 互联网 发布时间: 2014-02-18
修改dialog的大小
1.在manifest.xml中activity添加
android:theme="@android:style/Theme.Dialog"
2.WindowManager m = getWindowManager();
Display d = m.getDefaultDisplay(); //为获取屏幕宽、高
LayoutParams p = getWindow().getAttributes(); //获取对话框当前的参数值
p.height = (int) (d.getHeight() * 0.6); //高度设置为屏幕的0.6
p.width = (int) (d.getWidth() * 0.95); //宽度设置为屏幕的0.95
getWindow().setAttributes(p); //设置生效
1.在manifest.xml中activity添加
android:theme="@android:style/Theme.Dialog"
2.WindowManager m = getWindowManager();
Display d = m.getDefaultDisplay(); //为获取屏幕宽、高
LayoutParams p = getWindow().getAttributes(); //获取对话框当前的参数值
p.height = (int) (d.getHeight() * 0.6); //高度设置为屏幕的0.6
p.width = (int) (d.getWidth() * 0.95); //宽度设置为屏幕的0.95
getWindow().setAttributes(p); //设置生效
最新技术文章: