我想在android中添加如上图所示的图标 我怎么能这样做
这是我的menu.xml,我尝试使用android:icon,它没有显示
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.kahheng.smartchat.MainActivity">
<item
android:id="@+id/action_poll"
android:orderInCategory="100"
android:layout_width="35dp"
android:layout_height="50dp"
android:title="@string/action_poll"
android:icon="@mipmap/pollbtn"
app:showAsAction="always" />
<item
android:id="@+id/action_draw"
android:orderInCategory="100"
android:layout_width="35dp"
android:layout_height="50dp"
android:title="@string/action_draw"
android:icon ="@mipmap/drawbtn"
app:showAsAction="always" />
<item
android:id="@+id/action_bookmark"
android:orderInCategory="100"
android:layout_width="35dp"
android:layout_height="50dp"
android:icon="@drawable/sendbtn"
android:title="@string/action_bookmark"
app:showAsAction="always" />
</menu>
我该怎么做才能显示图标?
这是我的主要活动
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId())
{
case R.id.action_draw:
Intent newActivity = new Intent(MainActivity.this, DrawingActivity.class);
startActivity(newActivity);
break;
//Me
case R.id.action_poll:
Intent pollActivity = new Intent(MainActivity.this, pollActivity.class);
startActivity(pollActivity);
break;
case R.id.action_bookmark:
Intent bookmarkActivity = new Intent(MainActivity.this, bookmarkActivity.class);
startActivity(bookmarkActivity);
break;
}
return true;
}