这里是一个简单的XML文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:animateLayoutChanges="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#0061C2"
android:minHeight="?attr/actionBarSize"
app:popupTheme="@style/Theme.AppCompat.Light.DarkActionBar"
app:theme="@style/Toolbar"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:id="@+id/myLayout"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:background="#ffff7100"
android:visibility="gone">
</RelativeLayout>
</RelativeLayout>
工具栏是behinf “myLayout”,因此,如果 “myLayout” 可见它会隐藏在你的java工具栏 ,当点击该项目
(findViewById(R.id.myLayout).setVisibility(View.VISIBLE);
并且会显示一个布局,您将看到一个动画因为我使用
android:animateLayoutChanges="true"
在myLayout的底部添加相同的项目,并添加此作为其onClickListener
(findViewById(R.id.myLayout).setVisibility(View.GONE);
为此,您可以使用工具栏
你是如何解决它的? –
对不起。我没有解决 – DroidLearner