When setting the layout height and width, android studio is showing an error that attribute
android:layout_height and android:layout_width is not allowed here respectively.
And also setting TextView is showing error:-
Element TextView is not allowed here.
I have read and tried the answers of Element LinearLayout is not allowed in CardView but it did not helped.
I have checked for any extra opening or closing brackets but there is none. Is there problem in the gradle.build file? I have checked but it looks fine.
Here is the code in activity__main.xml file.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:textSize="20sp" />
</FrameLayout>
Here is the code of build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
defaultConfig {
applicationId "com.android.example.favoritetoys"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:25.1.0'
}