I am using Zoom effect with ImageView so I need to use scaletype=matrix. Now, I want to set Center position to ImageView but I am not able to set it.
Please help me regarding this.
layout.xml :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imgImage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="@string/imgdesc"
android:scaleType="matrix"
android:src="@drawable/ic_answer" />
</RelativeLayout>
try below code:
or
or
I had the sameproblem. Eventually I Gave up for using Matrix and replaced it with this:
Under
android:scaleType="matrix"
circumstance, the only way I found is to use Matrix to set ImageView position, use the following code:Put the following lines of code:
Hope this will help you.
try this to your
ImageView
try this,
this may help you