Abdus Sami Khan
Abdus Sami Khan

Reputation: 277

Icon's size in Custom Layout Android

I want to change the size of my app's icon in Custom Title bar. Here's my code so far:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:paddingLeft="5dip"
android:background="#000000">

<ImageView
    android:id="@+id/header"
    android:src="@drawable/ic_launcher"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:adjustViewBounds="true"
    android:scaleType="fitXY"/>

</LinearLayout>

My styles.xml file is:

  <style name="CustomWindowTitleBackground">
    <item name="android:background">#00000000</item>
    </style>

   <style name="CustomTheme" parent="android:Theme">
    <item name="android:windowTitleSize">30dip</item>

    <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>

This produces an icon on the left of the title bar but how can I change the icon's size ? I want the icon to be a little larger.

Upvotes: 3

Views: 9065

Answers (1)

Booger
Booger

Reputation: 18725

Maybe you should just set specific DP attributes for your ImageView. Stick with DP, and is will scale fine on all devices. Like this:

<ImageView
    android:id="@+id/header"
    android:src="@drawable/ic_launcher"
    android:layout_width="48dp"
    android:layout_height="48dp"
    android:adjustViewBounds="true"
    android:scaleType="fitXY"/>

Upvotes: 6

Related Questions