简体   繁体   中英

how to add a view to existing chain in android studios

I am creating individual test activities in android studios as i need them (before combining these tests into my project at a later date) so I have to periodically add more buttons to start new activities as they are added. I have only found a long workaround of removing constraints and creating a new chain and resetting the constraints for each item (a tedious process as they are constrained to guidelines, so each have to be reset to 0dp each time)

Despite my experimenting with the IDE over the last couple months and googling /seacrching stackOverflow, i cannot find a way to simply 'add to existing chain' ie another (button) view to the bottom of a verical chain?

I don't know how to do it using design window, but you always can open code window with XML . The idea is that chain automatically generates when you constraining neighboring sides of two views. In the example below chain between two TextViews will appear:

    <TextView
        android:id="@+id/view_1"
        ...
        app:layout_constraintRight_toLeftOf="@+id/view_2"/>

    <TextView
        android:id="@+id/view_2"
        ...
        app:layout_constraintLeft_toRightOf="@id/view_1"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM