Reputation: 61
I have an icon that I have declared in my application tag in the manifest file as android:icon="@drawable/ic_myIcon"
This icon is too close to the heading on the left how can I padd it to the right or some other way to insert space.
Thanks
Upvotes: 2
Views: 82
Reputation: 1836
I don't know if this is possible, but try create this drawable and set as icon
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<bitmap android:src="@drawable/your_icon_res_image" />
</item>
<item android:right="20dp">
<shape android:shape="rectangle" >
<solid android:color="@color/transparent" />
</shape>
</item>
</layer-list>
Upvotes: 0
Reputation: 3421
You can use android:paddingRight
or android:paddingEnd
. In new APIs to handle RTL locale should be use android:paddingEnd
. Also you can use android:layout_marginRight
or android:layout_marginEnd
.
For example :
<ImageView
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo"
android:contentDescription="@string/logo"
android:layout_marginEnd="20dp" />
Or
<ImageView
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo"
android:contentDescription="@string/logo"
android:paddingEnd="20dp" />
Upvotes: 0
Reputation: 6884
All you need to do is the following:
android:paddingRight= "5dp"
You can change the amount of padding you need by increasing or descreasing the dp
size
Alternatively you can also use margins instead of paddings. Hope this solves your issue :)
Upvotes: 1