0
Good night, you guys! I am trying to create an application with navigationView pwla first time and am encountering problems at the time of setContentView(R.layout.activity_main) call; the application consists of Activity main calling some Fragments according to the menu item clicked, so the error already happens at the beginning of Activity when trying to mount xml: activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
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:id="@+id/dl_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.ramattecgmail.rafah.studying.Activitys.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nv_main"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:headerLayout="@layout/header_nav"
app:menu="@menu/menu_nav" />
</android.support.v4.widget.DrawerLayout>
menu_nav.xml
<?xml version="1.0" encoding="utf-8"?>
<group android:checkableBehavior="single">
<item
android:id="@+id/gi_perfil"
android:checked="false"
android:title="@string/gi_perfil"/>
<item
android:id="@+id/gi_abrirA"
android:checked="false"
android:title="@string/gi_abrirA"/>
<item
android:id="@+id/gi_consultarA"
android:checked="false"
android:title="@string/gi_consulta"/>
<item
android:id="@+id/gi_avaliar"
android:checked="false"
android:title="@string/gi_avaliar"/>
<item
android:id="@+id/gi_email"
android:checked="false"
android:title="@string/gi_email"/>
<item
android:id="@+id/gi_config"
android:checked="false"
android:title="@string/gi_config"/>
<item
android:id="@+id/gi_sair"
android:checked="false"
android:title="@string/gi_sair"/>
</group>
header_nav.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/img_perfil"
android:layout_width="@dimen/circle_image_header"
android:layout_height="@dimen/circle_image_header"
android:src="@drawable/profile"
app:border_color="#FF000000"
android:layout_marginLeft="@dimen/mrg_imagem_perfil"
android:layout_marginStart="@dimen/mrg_imagem_perfil"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<TextView
android:id="@+id/tv_nome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:text="Nome do usuario"
android:textSize="@dimen/tam_text_perfil"
android:textColor="#fff"
android:textStyle="bold"
android:paddingBottom="4dp"
android:layout_above="@+id/tv_email"
android:layout_alignLeft="@+id/img_perfil"
android:layout_alignStart="@+id/img_perfil" />
<TextView
android:id="@+id/tv_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:text="Email do Usuario"
android:textSize="@dimen/tam_text_perfil"
android:textColor="#fff"
android:layout_marginBottom="@dimen/mrg_bot_tvemail"
android:layout_alignParentBottom="true"
android:layout_alignLeft="@+id/tv_nome"
android:layout_alignParentStart="@+id/tv_nome" />
Style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
app.Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.ramattecgmail.rafah.studying"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//FireBase
//Google
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.android.support:design:26.+'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:support-v4:26.+'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Thank you!
Sorry, I had not seen that I had sent the main.xml file missing some parts, but now it is complete, the error is being indicated precisely on line 29 where I urge navigationView
– Eduardo Rafael Moraes
Thank you very much ! That’s right! The problem was in the header just in Circleimageview, I made the change as suggested in your link and it worked well ! Thank you very much !!!
– Eduardo Rafael Moraes