From the course: Android Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Convert a layout to ConstraintLayout

Convert a layout to ConstraintLayout - Android Tutorial

From the course: Android Development Tips

Convert a layout to ConstraintLayout

- [Instructor] In Android Studio 2.3, new applications built with Android Studio's templates use the constraint layout to lay out activities and other components. You can see this in some of the layout files. For example, this layout file, content_main.xml, has a constraint layout as its root. It only contains a few objects, a text view and two buttons. But you can create very complex layouts with constraint layout without creating a lot of layers in your layout hierarchy. I'm going to describe how to convert an existing layout to use constraint layout, and I'll do this with a dialogue layout that I created in a previous tip. This class, EditTextDialog uses this layout, dialog_edit_text.xml. And it uses a relative layout as its root. I'm going to start by converting the dialog to use constraint layout and then show you some adjustments you might want to make. I'll do the conversion in design mode, and I'll go to the component tree window, and I'll right-click on the root element…

Contents