您好,登錄后才能下訂單哦!
關于View的屬性
自定義動態設置View的大小屬性
使用LayoutParams來設置view的寬高.
int textLen = AddShopActivity.mCategoryItemNames1[type][textPos].length(); final int dimension = (int) (getResources().getDimension(R.dimen.text_size)); int left = dimension * textLen + (int) (getResources().getDimension(R.dimen.rl_left)); RelativeLayout.LayoutParams lp2 = new LayoutParams(left + (int) (getResources().getDimension(R.dimen.rl_right)), (int) (getResources().getDimension(R.dimen.rl_height))); lp2.setMargins(0, (int) (getResources().getDimension(R.dimen.rl_top)), 0, (int) (getResources().getDimension(R.dimen.rl_top))); mRL01.setLayoutParams(lp2); mDeleteBt = (Button) mRLMain.findViewById(R.id.deletebt); MarginLayoutParams marginsParams = new MarginLayoutParams( mDeleteBt.getLayoutParams()); marginsParams.setMargins(left, 0, 0, 0); RelativeLayout.LayoutParams lp = new LayoutParams(marginsParams);
ViewGroup內部View的圖層關系
bar.bringToFront();
在辛顯龍Blog中是這樣解釋的: Android中的ViewGroup是通過一個Array來保存其Children,當調用某個childView的bringToFront時,是將該childView放在其Parent的Array數組的最后,ViewGroup的dispatchDraw在draw時是按照Array從前往后依次調用drawChild的,這樣最后一個childView就在最前面了。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。