0
私は自分で作成したツールバー、カスタムツールバーを持っており、毎回私がツールバーを置き換えるアイコンをクリックするたびにsearchviewを配置したいと思っています。searchviewカスタムツールバーの実装
マイカスタムツールバー:今、私はこのカスタムツールバーのsearchviewを使用したいが、私はでき
<include
layout="@layout/custom_toolbar"
android:id="@+id/my_toolbar"
tools:layout_constraintTop_creator="1"
tools:layout_constraintLeft_creator="1"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp" />
:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/emerald">
<ImageView
android:id="@+id/arrow_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="0"
android:src="@drawable/ic_002_keyboard_left_arrow_button"
android:onClick="previousActivity"
android:tint="@color/white"/>
<com.example.afcosta.inesctec.pt.android.Helpers.NexusBoldTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:layout_gravity="left"
android:layout_marginLeft="25dp"
android:id="@+id/toolbar_title"
android:textSize="@dimen/toolbar_title" />
<ImageView
android:id="@+id/user_ic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="0"
android:src="@drawable/ic_user"
android:onClick="userProfile"
android:layout_marginRight="25dp"
android:tint="@color/white"/>
<ImageView
android:id="@+id/user_ic2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="0"
android:src="@drawable/ic_search_black_24dp"
android:tintMode="@color/white"
android:onClick="userProfile"
android:layout_marginRight="25dp"
android:tint="@color/white"/>
</android.support.v7.widget.Toolbar>
私はこのような他の活動にそれを含めますどんな助けでもそれを加えないでください。
私は検索とImageViewのを持っているではアイテム
でメニューを作成しますか? –