Java代码: 1 ) 定义 ViewStub < ViewStub Android : id = "@+ id / stub _ import " android : inflatedId ="@+ id / panel _ import " android : layout ="@ layout / progress _ overlay " android : layout _ width =" fill _ parent " android:layout_height="wrap_content" android:layout_gravity="bottom"/> 2 )展开视图 findViewById(R.id.stub_import).setVisibility(View.VISIBLE); // 或者 获取视图 View importPanel = ((ViewStub) findViewById(R.id.stub_import)).inflate(); 1 ) 定义 ViewStub < ViewStub android : id = "@+ id / stub _ import " android : inflatedId ="@+ id / panel _ import " android : layout ="@ layout / progress _ overlay " android : layout _ width =" fill _ parent " android:layout_height="wrap_content" android:layout_gravity="bottom"/> 2 )展开视图 findViewById(R.id.stub_import).setVisibility(View.VISIBLE); // 或者 获取视图 View importPanel = ((ViewStub) findViewById(R.id.stub_import)).inflate(); |