Android涔媋ndroid:layout_weight璇﹁В
16lz
2021-01-25
1銆丩inearLayout鍙互涓哄叾鍖呭惈鎺т欢鎸囧畾濉厖鏉冨€糽ayout_weight銆?杩欐牱灏卞厑璁稿叾鍖呭惈鐨勬帶浠跺彲浠ュ~鍏呭睆骞曚笂鐨勫墿浣欑┖闂淬€傝繖涔熼伩鍏嶄簡鎵€鏈夋帶浠舵尋鎴愪竴鍫嗙殑鎯呭喌锛岃€屾槸鍏佽浠栦滑鏀惧ぇ濉厖鎵€鏈夌┖鐧姐€傚墿浣欑殑绌洪棿浼氭寜杩欎簺鎺т欢鎸囧畾鐨勬潈鍊兼瘮渚嬪垎閰嶅睆骞曘€?/p>
2銆侀粯璁ゆ儏鍐典笅锛寃eight鐨勫€兼槸0锛岃〃绀烘寜鐓ф帶浠剁殑瀹為檯澶у皬鏄剧ず锛涘鏋渨eight璁剧疆楂樹簬闆躲€?/p>
3銆佸墿浣欑┖闂翠細鎸夌収璇ユ帶浠剁殑weight鍊煎崰鎵€鏈夋帶浠秝eight鐨勬瘮渚嬪垎閰嶇粰璇ユ帶浠躲€?姣斿鏈変袱涓帶浠讹紝涓€涓獁eight涓?锛屽彟澶栦竴涓槸2. 鍒欏墿浣欑┖闂翠細鎶?/(1+2)鐨勯儴鍒嗙粰鎺т欢涓€锛屽彟澶?/(1+2)鐨勫垎閰嶇粰鎺т欢浜屻€備篃灏辨槸鏉冨€艰秺澶э紝閲嶈搴﹁秺澶с€?/p>
4銆佸鏋淟inearLayout鍖呭惈瀛怢inearLayout锛屽瓙LinearLayout涔嬮棿鐨勬潈鍊艰秺澶х殑锛岄噸瑕佸害鍒欒秺灏忋€傚鏋滄湁LinearLayout A鍖呭惈LinearLayout C,D锛孋鐨勬潈鍊间负2锛孌鐨勬潈鍊间负1锛屽垯灞忓箷鐨?/3绌洪棿鍒嗙粰鏉冨€间负1鐨凞锛?/3鍒嗙粰鏉冨€间负2鐨凜銆傚湪LinearLayout宓屽鐨勬儏鍐典笅锛屽瓙LinearLayout蹇呴』瑕佽缃潈鍊硷紝鍚﹀垯榛樿鐨勬儏鍐垫槸鏈缃潈鍊肩殑瀛怢inearLayout鍗犳嵁鏁翠釜灞忓箷銆?/p>
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_weight="2"> <SurfaceView android:id="@+id/surfaceView" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_weight="1" android:layout_gravity="center"> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/btnTakePicture" android:gravity="center" android:textSize="20px" android:text="鎷嶇収"/> </LinearLayout> </LinearLayout>杞浇鍦板潃锛?http://www.cnblogs.com/linjiqin/archive/2011/12/27/2303519.html |
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer