Style popup menu scroll bar

pull/187/head
M66B 4 years ago
parent f748c3717c
commit 272bed17d9

@ -25,6 +25,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.appcompat.widget.PopupMenu;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
@ -34,7 +35,7 @@ import androidx.lifecycle.OnLifecycleEvent;
public class PopupMenuLifecycle extends PopupMenu implements LifecycleObserver {
public PopupMenuLifecycle(@NonNull Context context, LifecycleOwner owner, @NonNull View anchor) {
super(context, anchor);
super(new ContextThemeWrapper(context, R.style.popupMenuStyle), anchor);
Log.i("Instantiate " + this);
owner.getLifecycle().addObserver(this);

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?attr/colorAccent" />
</shape>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?attr/colorSeparator" />
</shape>

@ -444,4 +444,10 @@
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Small</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="popupMenuStyle" parent="Base.Widget.AppCompat.PopupMenu">
<item name="android:scrollbarSize">6dp</item>
<item name="android:scrollbarThumbVertical">@drawable/scroll_thumb_popup</item>
<item name="android:scrollbarTrackVertical">@drawable/scroll_track_popup</item>
</style>
</resources>

Loading…
Cancel
Save