答案 0 :(得分:0)
创建自定义视图
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_view"
android:layout_width="match_parent"
android:layout_height="64dp"
android:visibility="gone"
android:layout_alignParentBottom="true"
android:clickable="true">
<!-- Anything you need -->
</RelativeLayout>
在 onCreate 方法初始化视图,如
mCustomView = (RelativeLayout) findViewById(R.id.custom_view);
在 onOptionsItemSelected 方法中执行下一步:
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.some_menu) {
mCustomView.setVisibility(View.VISIBLE);
// do some animation there
}
return super.onOptionsItemSelected(item);
}