如何在android studio 3中使用photoview 2.0.0

问题描述 投票:-1回答:1

我有来自github的photoview库的问题...如何将我的图像投射到photoview?我在.java文件中有错误而且没有... !!!

enter image description here

它是我的XML文件的图像

enter image description here

casting photo photo-gallery android-photoview
1个回答
0
投票

你应该把它放在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 );
}
© www.soinside.com 2019 - 2024. All rights reserved.