Problems with ConstraintLayout - ImageView 16:9 inappropriate top margin

前端 未结 5 509
鱼传尺愫
鱼传尺愫 2021-01-29 01:00

I want to build the following layout using ConstraintLayout:

I use this source for layout:


<         


        
5条回答
  •  轮回少年
    2021-01-29 02:01

    The first two answer will work. You can also add app:layout_constraintVertical_chainStyle="spread_inside" to the top ImageView if you want to maintain your vertical chain.

    Here is an image after adding this statement (but not changing anything else.)

    Here is the XML:

    
    
        
    
            
    
            
    
            
    
        
    
    

    Update: So the above doesn't work on API 23 with ConstraintLayout version 1.0.2. Try the following instead:

    Remove android:layout_marginTop="16dp" from textView2 and add android:layout_marginBottom="16dp" to textView1. This makes a difference.

提交回复
热议问题