再次,我在损失使用操作栏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