您的位置:首页 > 编程语言 > Java开发

eclipse安卓引入库项目的正确方法

2016-07-10 08:31 323 查看
之前清单文件里theme主题老是改不成库项目里定义好的主题@style/Theme.AppCompat.Light,只能用默认主题@style/AppTheme

<application
android:name="com.example.googleplay.global.GooglePlayApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light" >
<activity
android:name="com.example.googleplay.ui.activity.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>


找了半天也没发现什么问题,库项目也导入了啊,为什么不能用库项目里定义的东西

原来我是用的java build path的方法导入库项目,错误做法如下



原来安卓导入库项目跟一般的java导入项目的方法不同,安卓的导入方法(在项目上右键,选择properties,再选择Android,在Library那里add库项目即可):



安卓导入的方法不同是因为安卓还需要除了代码的引用之外,还要用到库项目里已有的资源(layout,themes,strings,dimens,colors,styles等);而java引入库项目只是为了用库项目里的方法
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: