API21+ ツールバー
を使用する。
// Toolbar
Toolbar toolbar = new Toolbar(this);
toolbar.showOverflowMenu();
その影を完全に除去したい。setElevation(0)は
getElevation()がすでに
0` を返しているので、何もしません。
マテリアルデザインの参考文献があります。
https://material.io/guidelines/layout/structure.html#structure-toolbars
デベロップリファレンスがあります。
https://developer.android.com/reference/android/widget/Toolbar.html
しかし、シャドウに関連する情報は見当たりません。ツールバー
Question: ツールバーの影を完全に消す/隠すにはどうしたらいいですか?
ツールバーには android:elevation
の代わりに app:elevation="0dp"
を使ってください。
もし、うまくいかない場合は、ツールバーをAppBarLayout
の中に入れて、app:elevation="0dp"
を設定してください。
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp">
...
</android.support.design.widget.AppBarLayout>
私自身、解決策を見つけました。
getActionBar().setElevation(0);
詳しくはこちら
https://developer.android.com/reference/android/app/Activity.html#getActionBar()
android:elevationの代わりにapp:elevationを試してみてください。
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:elevation="0dp">
</android.support.design.widget.AppBarLayout>