代码之家  ›  专栏  ›  技术社区  ›  A.T.A.P

如何在android studio 3中使用photoview 2.0.0

  •  -1
  • A.T.A.P  · 技术社区  · 7 年前

    我对gihub的photoview库有问题。。。如何将图像投射到photoview?我有一个错误。java文件,没有更多。。。!!!

    enter image description here

    这是我的XML文件的图像

    enter image description here

    1 回复  |  直到 5 年前
        1
  •  0
  •   Enzokie terencey    7 年前

    你应该把它放进去 onCreate 而不是在外面。

    protected void onCreate(Bundle bundle){
       super.onCreate(bundle);
       setContentView(R.layout.activity_main);
    
       PhotoView view = (PhotoView) findViewById(R.id.photo_view);
       view.setImageResource( your-image-here );
    }