I'm wondering how to display both of icon and title in android menu.
I'm using this :
<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.yasser.version6.NewprofileActivity">
<item
android:id="@+id/action_done"
android:title="SUIVANT"
android:orderInCategory="100"
android:icon="@drawable/ic_action_done"
app:showAsAction="always|withText" />
</menu>
Here is my activity, I'm extending AppCompatActivity is that fine ?, and then I'm using a custom toolbar for my application
public class NewprofileActivity extends AppCompatActivity {
ImageView profil_image;
Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_newprofile);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setTitle("Profil");
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
profil_image= (ImageView) findViewById(R.id.profil_image);
Picasso.with(profil_image.getContext()).load(R.drawable.profil_icon).transform(new Imagetransformation()).into(profil_image);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_newprofile, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
but the title is showing only on landscape