ご覧のとおり、メニューまたは検索ボタンの3つの点がツールバーの上3分の1にあります。どうやってセンターに置くことができますか? もしその関連 - 私のXMLの一部:設定または検索の3つの点を中心にする
tool_bar.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/ColorPrimary"
android:elevation="4dp" >
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="start"
android:src="@drawable/app_icon" />
</android.support.v7.widget.Toolbar>
activity_main.xml:
<include
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
layout="@layout/tool_bar" >
</include>
<other views>
searchable.xml:
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:hint="@string/hint_search"
android:icon="@drawable/magnifying_glass"
android:label="@string/app_name"
android:searchSuggestAuthority="com.app.recommendations.content_provider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData=""
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" />
main_menu.xml :
...
<item
android:id="@+id/search"
android:icon="@drawable/magnifying_glass"
android:title="@string/hint_search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="collapseActionView|ifRoom"/>
...
カスタムツールバーを作成して、検索アイコンの中心にすることができます。 –
どのように?それをしてもいいですか? – Ran
検索アイコンを中央に配置したい場合は、それが役に立ちます。なぜあなたは3つの点を中心にしたいのですか? –