How can I place a ProgressBar at the right of the Toolbar?

前端 未结 3 1972
名媛妹妹
名媛妹妹 2020-12-24 13:21

With the new Lollipop API, we have to use a Toolbar if we want to personalize the action bar aspect.

Adding a ProgressBar to the Toolbar is as simple as adding it to

3条回答
  •  萌比男神i
    2020-12-24 13:37

    I also hit the same wall, but programmatically it works:

        Toolbar.LayoutParams layoutParams = new Toolbar.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT,
                Gravity.TOP | Gravity.RIGHT);
    

    In my snippet, I align it to the top, to match the alignment of the menu.

提交回复
热议问题