再次,我在損失使用操作欄sherlock在這裏..它似乎我添加的按鈕不出現在所有。以下是我已經在做安卓吧sherlock添加按鈕
我的清單
<activity android:name=".RecipeBookList" android:theme="@style/SherlockCustom"></activity>
,並在我的styles.xml
<style name="SherlockCustom" parent="@style/Theme.Sherlock.Light">
<item name="abHeight">25dip</item>
<item name="abBackground">#ffffff</item>
<item name="abDisplayOptions">useLogo|showHome|homeAsUp|showTitle</item>
</style>
,並在我的RecipeBookList.java
public class RecipeBookList extends FragmentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recipebooklist);
GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this));
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
//Toast.makeText(RecipeBookList.this, "" + position, Toast.LENGTH_SHORT).show();
displayRecipeList(""+position);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.mainmenu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Toast.makeText(this, "Just a test", Toast.LENGTH_SHORT).show();
return true;
}
aind在我的MainMenu。 xml
<item android:id="@+id/preferences" android:title="Search" android:showAsAction="always|withText" android:icon="@drawable/ab_search"></item>
但是搜索按鈕根本沒有出現在操作欄中..實際上它並沒有出現在任何地方。我哪裏錯了?
的人?我在這裏死亡 – imin 2012-02-17 08:40:22