目前我正在尝试使用以下代码设置我以编程方式创建的视图的位置:
LayoutParams params = bottomBar.getLayoutParams();
params.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,(float) 5, getResources().getDisplayMetrics());
params.width = LayoutParams.MATCH_PARENT;
bottomBar.setLayoutParams(params);
bottomBar.setLeft(0);
bottomBar.setTop(this.getHeight()-bottomBar.getHeight());
问题
我得到的错误是我不能在低于 11 的 api 级别中使用setLeft
and属性。setTop
问题
如何以编程方式设置视图的位置API level < 11