【问题标题】:Zoom and Sliding not working for image in android缩放和滑动不适用于android中的图像
【发布时间】:2021-01-20 07:50:21
【问题描述】:

我正在尝试在单击时为图像添加全屏图像查看器功能,它应该包括放大/缩小和左右滑动。 我使用 TouchImageView 和 ViewPager 成功添加了该功能,但是在缩放或幻灯片图像上正在重新绘制和堆叠(附加图像)。

我在没有 viewpager 的情况下尝试过,即使使用 photoview 之类的库,问题仍然存在。 请帮忙!任何帮助都将不胜感激。

代码 布局.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>

fullscreeActivity的oncreate方法,当用户点击GalleryActivity上的图片时该Activity启动

 @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);

尝试使用此代码 https://github.com/Baseflow/PhotoView/blob/master/sample/src/main/java/com/github/chrisbanes/photoview/sample/SimpleSampleActivity.java

问题依然存在。

【问题讨论】:

标签: java android android-glide photoview


【解决方案1】:

现在我已经解决了上述错误,因为它是由于我在 Android_menifest.xml 文件中使用的错误主题导致了这个错误。

旧文件

  <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>

删除主题并为我的全屏活动使用默认主题后文件中的新内容

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

【讨论】:

    猜你喜欢
    • 2012-10-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-30
    • 1970-01-01
    • 1970-01-01
    • 2010-11-25
    • 2014-02-22
    • 1970-01-01
    相关资源
    最近更新 更多