ConstraintLayout: how to have a view be half the screen width and centered?

后端 未结 5 1199
半阙折子戏
半阙折子戏 2020-12-16 09:49

TL;DR
The view width must be exactly half of the screen, and be centered. Using ConstraintLayout.

Note that the view does not have

5条回答
  •  感情败类
    2020-12-16 10:01

    With ConstraintLayout, you can center a view in the screen like this:

    
    
    
        
    
    
    

    Update your gradle to the last version of ConstraintLayout:

    dependencies {
    ...
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    }
    

提交回复
热议问题