Reputation: 1120
This is the style for my activity
<style name="AppTheme" parent="android:Theme.Holo.Light.Dialog.MinWidth">
<item name="android:windowTitleStyle">@android:style/TextAppearance.Holo.Large</item>
<item name="android:windowCloseOnTouchOutside">true</item>
</style>
and it is correctly displayed as a not full screen dialog, as desired. I'd like to display an icon also to the left of the activity title but I cannot figure out how. Thanks in advance.
PS minSdkVersion 13
Upvotes: 1
Views: 897
Reputation: 30804
When you use that style, Android will use a layout that doesn't include an ImageView
for an icon. However, you can call TextView.setCompoundDrawablesWithIntrinsicBounds
using the TextView
that displays the title to show your icon. Otherwise you might look into an implementation like this.
Implementation:
final TextView title = (TextView) findViewById(android.R.id.title);
if (title != null) {
title.setPadding(30, 0, 0, 0);
title.setCompoundDrawablePadding(30);
title.setCompoundDrawablesWithIntrinsicBounds(R.drawable.your_icon, 0, 0, 0);
}
Results
Upvotes: 1