使用Java動態設置官方百分比佈局PercentRelativeLayout的heightPerce

View view = findViewById(R.id.view_child);
PercentRelativeLayout.LayoutParams params = (PercentRelativeLayout.LayoutParams) view.getLayoutParams();
// This will currently return null, if it was not constructed from XML.
PercentLayoutHelper.PercentLayoutInfo info = params.getPercentLayoutInfo();
info.heightPercent = 0.60f;
view.requestLayout();

http://stackoverflow.com/questions/32292656/percentrelativelayout-how-to-set-the-height-programaticallyandroid

https://github.com/JulienGenoud/android-percent-support-lib-sample/issues/8git

相關文章
相關標籤/搜索