Android center view in FrameLayout doesn't work

前端 未结 5 1730
梦谈多话
梦谈多话 2021-02-04 22:47

I have a FrameLayout in which I have 2 controls: - a custom view which draws a image and some text on it - a textview with a text

I want to center both in the FrameLayo

5条回答
  •  不知归路
    2021-02-04 23:41

    To center a view in Framelayout, there are some available tricks. The simplest one I used for my Webview and Progressbar(very similar to your two object layout), I just added android:layout_gravity="center"

    Here is complete XML in case if someone else needs the same thing to do

    
    
        
        
    
    
    
    

    Here is my output

提交回复
热议问题