海的朋友......我的Java文件指出这个错误: R.styleable解决不了....R.styleable解决不了
我的XML文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/videoGrdVw"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="auto_fit"
android:verticalSpacing="5dip"
android:horizontalSpacing="5dip"
android:columnWidth="80dip"
android:stretchMode="columnWidth"
android:gravity="center"/>
<ImageSwitcher
android:id="@+id/switcher"
android:layout_height="match_parent"
android:layout_width="match_parent">
</ImageSwitcher>
<resources>
<declare-styleable name="HelloGallery">
<attr name="android:galleryItemBackground" />
</declare-styleable>
</resources>
</LinearLayout>
源代码如下:
private class VideoGalleryAdapter extends BaseAdapter
{
private int itemBackground;
public VideoGalleryAdapter(Context c)
{
_context = c;
TypedArray a = obtainStyledAttributes(R.styleable.Gallery1);
itemBackground = a.getResourceId(
R.styleable.Gallery1_android_galleryItemBackground, 0);
a.recycle();
}
可能的重复[Android Hello,Gallery tutorial - “R.styleable can not be resolved”](http://stackoverflow.com/questions/1717489/android-hello-gallery-tutorial-r-styleable-cannot-解决) – 2012-11-20 22:26:43
请确保您明确导入您的R类 – 2017-01-21 10:13:39