Daniyal
Daniyal

Reputation: 233

increase the size of the image inside the imageview

enter image description here enter image description here

By increasing the image size only the width and height of the imageview is getting increased, however i need to increase the actual image i.e add note image not just the background getting increased(as shown in the picture attached)

Moreover i want this clickable image to take the complete width of the phone and 1/3 of the phone's screen height, how is that possible?

Thanks

Upvotes: 0

Views: 1697

Answers (1)

rafsanahmad007
rafsanahmad007

Reputation: 23881

Try this:

for image use: android:scaleType="fitXY"

and for 1/3 of the screen use android weightsum and layout_weight

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="3">

    <ImageButton
        android:id="@+id/image_button"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@android:color/transparent"
        android:scaleType="fitXY"
        android:src="@android:drawable/ic_menu_add"
        android:visibility="visible" />

</LinearLayout>

output:

enter image description here

Upvotes: 1

Related Questions