Add height for ListPopupWindow

This commit is contained in:
Chumva 2018-09-07 12:02:55 +03:00
parent fb7af911e6
commit 46382bf3de
3 changed files with 7 additions and 0 deletions

View file

@ -64,6 +64,8 @@
<dimen name="title_letter_spacing" format="float">-0.03</dimen>
<dimen name="bottom_sheet_peek_height">300dp</dimen>
<dimen name="list_popup_window_height">300dp</dimen>
<!-- Text sizes -->

View file

@ -141,6 +141,7 @@ class SettingsDialogFragment : BaseDialogFragment() {
isModal = true
anchorView = valueView
setContentWidth(AndroidUtils.getPopupMenuWidth(ctx, menuList))
height = AndroidUtils.getPopupMenuHeight(ctx)
setDropDownGravity(Gravity.END or Gravity.TOP)
setAdapter(ArrayAdapter(ctx, R.layout.popup_list_text_item, menuList))
setOnItemClickListener { _, _, position, _ ->

View file

@ -116,6 +116,10 @@ object AndroidUtils {
return 0
}
fun getPopupMenuHeight(ctx: Context): Int {
return ctx.resources.getDimensionPixelSize(R.dimen.list_popup_window_height)
}
@ColorInt
fun getAttrColor(ctx: Context, @AttrRes attrId: Int, @ColorInt defaultColor: Int = 0): Int {
val ta = ctx.theme.obtainStyledAttributes(intArrayOf(attrId))