解压缩文件时遇到错误 错误:(3,29)找不到与给定名称匹配的资源(在'drawable'处,值为'@ drawable / common_google_signin_btn_icon_light_normal_background')。
错误:(3,29)找不到与给定名称匹配的资源(在'drawable'处,值为'@ drawable / common_google_signin_btn_text_dark_normal_background')。
但是在xml中没有错误标志
并在我的主要活动“R”中变红了
package com.androidbelieve.drawerwithswipetabs;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity{
DrawerLayout mDrawerLayout;
NavigationView mNavigationView;
FragmentManager mFragmentManager;
FragmentTransaction mFragmentTransaction;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/**
*Setup the DrawerLayout and NavigationView
*/
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
mNavigationView = (NavigationView) findViewById(R.id.shitstuff) ;
/**
* Lets inflate the very first fragment
* Here , we are inflating the TabFragment as the first Fragment
*/
mFragmentManager = getSupportFragmentManager();
mFragmentTransaction = mFragmentManager.beginTransaction();
mFragmentTransaction.replace(R.id.containerView,new TabFragment()).commit();
/**
* Setup click events on the Navigation View Items.
*/
mNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
mDrawerLayout.closeDrawers();
String title = "";
// Inserting navigation
if (menuItem.getItemId() == R.id.nav_item_sent) {
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.containerView,new SentFragment()).commit();
title = "Emergency Hotline";
}
if (menuItem.getItemId() == R.id.nav_item_inbox) {
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.containerView,new TabFragment()).commit(); //firstAid (health and life)
title = "First Aid and Survival Tips";
}
// [dito ipapasok ung sa map]
if (menuItem.getItemId() == R.id.nav_item_draft) {
/*FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.containerView,new MapFragment()).commit(); //firstAid (health and life)*/
title = "Locate Hospital";
Intent i = new Intent(MainActivity.this, MapsActivity.class);
startActivity(i);
}
/* if (menuItem.getItemId() == R.id.nav_item_map) {
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.containerView,new MapFragment()).commit(); //firstAid (health and life)
title = "Locate";
}*/
return false;
}
});
/**
* Setup Drawer Toggle of the Toolbar
*/
android.support.v7.widget.Toolbar toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar);
ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this,mDrawerLayout, toolbar,R.string.app_name,
R.string.app_name);
mDrawerLayout.setDrawerListener(mDrawerToggle);
mDrawerToggle.syncState();
}
}
这是我的傻瓜
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.androidbelieve.drawerwithswipetabs"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
maven {
url 'https://maven.google.com'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// compile 'com.google.firebase:firebase-database:9.8.0'
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.github.nirhart:parallaxscroll:1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
}