我想在我的項目中使用ActionBarActivity。我已經按照https://developer.android.com/tools/support-library/setup.html#錯誤項目檢索父':Theme.AppCompat.Light'在月蝕
中的說明導入了android-support-v7-appcompat到工作區中。我可以將appcompat項目作爲庫添加到當前項目(eclipse)中。
而且現在也沒有任何錯誤,當我使用下面的import語句。
import android.support.v7.app.ActionBarActivity;
從ActionBarActivity擴展我的類時沒有錯誤。
public class MyClass extends ActionBarActivity implements ActionBarListener {....}
但是,使用AppCompat風格時出現錯誤。
在清單中,
<activity
android:name=".Activity1"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
>
....
</activity>
在styles.xml,
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!-- API 11 theme customizations can go here. -->
</style>
我同時使用父= 「Theme.AppCompat.Light」 **錯誤得到styles.xml以下錯誤:錯誤檢索項目的父項:找不到與給定名稱'Theme.AppCompat.Light'匹配的資源。**
爲什麼我無法從appcompat su訪問資源pport圖書館。
P.S:我沒有用android:showAsAction="never"
我的兩個應用程序項目和程序兼容性是在同一文件夾(我都複製到當前工作區)。
嘗試清理您的項目 – Rohit 2014-10-27 11:20:07
嘗試過。不起作用。 – user3316561 2014-10-27 11:25:47