答案 0 :(得分:0)
如果您只想隐藏顶部和底部的ui,可以通过在每个视图或包含它们的布局上调用.setVisibility(View.INVISIBLE)
或.setVisibility(View.VISIBLE)
来实现。例如,您的代码可能如下所示:
@Override
protected void onCreate(Bundle savedInstanceState) {
...
ImageView iv = (ImageView) findViewById(R.id.imageView);
final View layout_with_stuff_to_hide = findViewById(R.id.layout);
iv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
layout_with_stuff_to_hide.setVisibility(layout_with_stuff_to_hide.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE);
}
});
}