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

前端 未结 3 1970
名媛妹妹
名媛妹妹 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
    慢半拍i (楼主)
    2020-12-24 13:32

    A workaround to create the layout completely in xml would be replacing the toolbar content with your own relative layout. To do that, you need to fake the activity title (and also the navigation icon if you are using one), which is literally nesting the following in your Toolbar block.

    
    
            
    
            
    
    
    

    Note that 20sp sans-serif-medium is the font used in lollipop toolbar, you might need to adjust the text view parameters to make it look natural in earlier versions.

提交回复
热议问题