Zoom and Sliding not working for image in android

176 views Asked by At

I am trying to add full screen image viewer functionality for an image when clicked, it should include zoom in/out with sliding left right. i successfully added that functionality with TouchImageView and ViewPager but on Zoom or slide images are getting redrawn and stacked(attached image).

enter image description here

i tried it without viewpager, and even by using library like photoview, still the problem persist. Please Help! any help would be greatly appreciable.

code layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <com.github.chrisbanes.photoview.PhotoView
        android:id="@+id/imgDisplay"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

oncreate method of fullscreeActivity, this activity started when user clicks an image on GalleryActivity

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fullscreen);
        ButterKnife.bind(this);

        /*viewPager = (ViewPager) findViewById(R.id.pager);*/


        Intent i = getIntent();
        int position = i.getIntExtra("position", 0);
        ArrayList<String> imageUrls = new ArrayList<String>(3);

        imgDisplay.setImageResource(R.drawable.amv6);

tried using this code https://github.com/Baseflow/PhotoView/blob/master/sample/src/main/java/com/github/chrisbanes/photoview/sample/SimpleSampleActivity.java

still problem persist.

enter image description here

1

There are 1 answers

0
ghufranne On BEST ANSWER

Now I have resolved the above error, As it was coming due to the wrong theme i was using in Android_menifest.xml file which is causing this error.

old file

  <activity
            android:name=".full_screen_image.FullscreenActivity"
            android:configChanges="orientation|keyboardHidden|screenSize" // remove this
            android:label="@string/title_activity_fullscreen"
            android:screenOrientation="portrait"
            android:theme="@style/FullscreenTheme"> // remove this
        </activity>

new content in file after removing theme and using default theme for my fullscreenactivity

       <activity
            android:name=".full_screen_image.FullscreenActivity"
            android:label="@string/title_activity_fullscreen"
            android:screenOrientation="portrait">
        </activity>