我想向父视图添加一个宽度为 100% 和 X%(例如:让它成为 40%)的视图
我有这个:
private RelativeLayout getParentView(){
return (RelativeLayout) MyActivity.this.getWindow().getDecorView().getRootView();
}
Run Code Online (Sandbox Code Playgroud)
我应该将父视图转换为 LinearLayout 或 RelativeLayout 可以实现吗?
以及如何以编程方式以百分比设置“myView”宽度和高度?
谢谢
java user-interface android android-view android-relativelayout