R.Java不会创建,因为我的代码中有错误,我不小心删除了R.java。
这里是代码:
public SwipeyTabs(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.SwipeyTabs, defStyle, 0);
mBottomBarColor = a.getColor(R.styleable.SwipeyTabs_bottomBarColor,
mBottomBarColor);
mBottomBarHeight = a.getDimensionPixelSize(
R.styleable.SwipeyTabs_bottomBarHeight, 2);
mTabIndicatorHeight = a.getDimensionPixelSize(
R.styleable.SwipeyTabs_tabIndicatorHeight, 3);
a.recycle();
init();
}
并且在xml中
<com.example.uniradio.SwipeyTabs
android:id="@+id/swipeytabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff3b3b3b"
swipeytabs:bottomBarColor="#ff96aa39"
swipeytabs:bottomBarHeight="2dip"
swipeytabs:tabIndicatorHeight="3dip" />
现在,如何创建它?
您基本上可以通过两种方式做到这一点:
您可以按照此处的建议从eclipse运行它,方法是转到Project-> Build Project,或者直接运行“ clean”
或者您可以尝试通过命令行为您的应用创建APK,然后将生成.R文件以及APK。
如果有任何错误,命令行将报告它。
要通过命令行执行,您可以运行以下命令:
ant release
从您的项目目录中]
由于XML中的错误,未生成R文件,请执行以下操作以查找错误,
我有像你一样的问题。最好的尝试:打开Android SDK Manager->在Tools文件夹中重新安装Android SDK Platform-Tools和Android SDK Build-Tools。
尝试这些技巧.....