The android studio project does not have a diameter.xml

I installed Android Studio 2.2.2 on my laptop. Then I updated it recently. But when I create an empty project, the project does not have a diameter.xml. If I used Android Studio 2.2.2, there is a directory called dens (with 2 dens.xml). What happened to my android studio?

+6
source share
1 answer

Your Android studio is fine. Starting with version 2.3, the default layout templates have ConstraintLayout as their root element with no fields applied to it. In older templates, this was a RelativeLayout with fields set as resource values ​​in dimens.xml . Since these values ​​are no longer in the default layout file, an empty project of the dimens.xml not created in the default project.

If you want to dimens.xml a dimens.xml , you can simply create it in the res/values folder with New -> Values resource file .


For reference, the old default layout that used the resources of a dimens :

 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.package.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> </LinearLayout> 

And the new default value:

 <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.package.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> 
+9
source

Source: https://habr.com/ru/post/1015583/


All Articles