<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();