<View android:layout_width="match_parent"
android:layout_height="2dip" android:background="#FF909090"
android:layout_marginLeft="40dip" android:layout_marginRight="40dip"
android:layout_marginTop="10dip" />
转载http://www.cnblogs.com/henryxu/archive/2013/04/10/3012081.html
//android获取屏幕的高度和宽度用到WindowManager这个类,两种方法: //第一种 WindowManager wm = (WindowManager) getContext() .getSystemService(Context.WINDOW_SERVICE); int width = wm.getDefaultDisplay().getWidth(); int height = wm.getDefaultDisplay().getHeight(); //第二种 WindowManager wm = this.getWindowManager(); int width = wm.getDefaultDisplay().getWidth(); int height = wm.getDefaultDisplay().getHeight();