Update layout parameters of view

// suppose we want to update layout_height parameter of following layout
// 
// 

// Solution
ViewGroup.LayoutParams layoutParams = mCategorySelectorBar.getLayoutParams();
layoutParams.height = LayoutUtils.getNPercentOfScreenHeightInPixel(this, 0.06f);
mCategorySelectorBar.setLayoutParams(layoutParams);

你可能感兴趣的:(Android)