Android R. 无法在可绘制文件夹中找到选项卡(清理和重建后的前夕)
Android R. Cant find tab in drawable folder (eve after cleaned and rebuild)
刚刚返回到我前几天正在工作的项目 - 当我离开它时,它是 运行,今天 错误:(67、93)错误:找不到符号变量drawtab1。清单可能有问题,尝试重建和清理。但是 drawtab1 没有显示..
TabHost tabHost = getTabHost();
// Tab for login
TabSpec Login = tabHost.newTabSpec("Login");
// setting Title and Icon for the Tab
Login.setIndicator("", getApplicationContext().getResources().getDrawable(R.drawable.drawtab1));
Intent LoginIntent = new Intent(this, Tab1Activity.class);
LoginIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Login.setContent(LoginIntent);
这是drawtab1
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected -->
<item android:drawable="@drawable/login"
android:state_selected="true" />
<!-- When not selected -->
<item android:drawable="@drawable/login" />
</selector>
这是Mainfest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tabdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="22"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Tab1Activity"
android:label="@string/title_activity_tab1" >
</activity>
<activity
android:name=".Tab2Activity"
android:label="@string/title_activity_tab2" >
</activity>
<activity
android:name=".Tab3Activity"
android:label="@string/title_activity_tab3" >
</activity>
</application>
</manifest>
如有任何帮助,我们将不胜感激。
这里可能有一些情况
1. make sure there is not import android.R import statement.
2. no error in typos in xml file.
3. use only a-z and 0-9 for resource name it must not contain any capital letters or special symbol. Then clean and sync your project.
刚刚返回到我前几天正在工作的项目 - 当我离开它时,它是 运行,今天 错误:(67、93)错误:找不到符号变量drawtab1。清单可能有问题,尝试重建和清理。但是 drawtab1 没有显示..
TabHost tabHost = getTabHost();
// Tab for login
TabSpec Login = tabHost.newTabSpec("Login");
// setting Title and Icon for the Tab
Login.setIndicator("", getApplicationContext().getResources().getDrawable(R.drawable.drawtab1));
Intent LoginIntent = new Intent(this, Tab1Activity.class);
LoginIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Login.setContent(LoginIntent);
这是drawtab1
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected -->
<item android:drawable="@drawable/login"
android:state_selected="true" />
<!-- When not selected -->
<item android:drawable="@drawable/login" />
</selector>
这是Mainfest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tabdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="22"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Tab1Activity"
android:label="@string/title_activity_tab1" >
</activity>
<activity
android:name=".Tab2Activity"
android:label="@string/title_activity_tab2" >
</activity>
<activity
android:name=".Tab3Activity"
android:label="@string/title_activity_tab3" >
</activity>
</application>
</manifest>
如有任何帮助,我们将不胜感激。
这里可能有一些情况
1. make sure there is not import android.R import statement.
2. no error in typos in xml file.
3. use only a-z and 0-9 for resource name it must not contain any capital letters or special symbol. Then clean and sync your project.