小编mei*_*eio的帖子

Android:无法从View投射到图库

我想在android中创建一个Gallery.为了设置适配器需要获取我在我的xml文件中定义的库.我这样做:画廊g =(画廊)findViewById(R.id.gallery1); 但是使用这段代码我无法编译我的项目,因为我得到错误"无法从视图转换为图库".我的xml文件看起来像这样:"

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   >
 <Gallery android:id="@+id/gallery1"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:gravity="bottom"
 />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

谁知道如何解决我的问题?非常感谢

android view gallery android-gallery

2
推荐指数
1
解决办法
2224
查看次数

标签 统计

android ×1

android-gallery ×1

gallery ×1

view ×1