android ScrollView 点击事件 ,求大神 急急急。。

cuojue306 2016-07-10 01:03:00
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0.0dip"
android:layout_weight="1.0" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<RelativeLayout
android:id="@+id/pgc_btn"
style="@style/left_drawer_item_layout"
android:visibility="gone" >

<TextView
android:id="@+id/pgc_name"
style="@style/left_drawer_item_text"
android:drawableLeft="@drawable/ic_drawer_pgc" />
</RelativeLayout>

<ImageView style="@style/left_drawer_item_line" />

<RelativeLayout
android:id="@+id/search_btn"
style="@style/left_drawer_item_layout" >


<TextView
style="@style/left_drawer_item_text"
android:drawableLeft="@drawable/ic_drawer_search"
android:text="@string/left_drawer_item_search" />
</RelativeLayout>
</LinearLayout>
</<ScrollView>
请问大神,红色部分怎么做一个点击事件啊,通过id看,应该是一个button,做button的点击事件就可以了,但是,事实上不行,用 Button searchButton = (Button) findViewById(R.Id.search_btn.) 会出现空指异常,
麻烦问下,大神,红色部分怎么做点击事件呢? 这个是别人的代码,没太懂

...全文
542 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cuojue306 2016-07-20
  • 打赏
  • 举报
回复
谢谢 解决
网络咖啡 2016-07-12
  • 打赏
  • 举报
回复
明显是RelativeLayout啊,代码应该是: RelativeLayout layout = (RelativeLayout)findViewById(R.id.serch_btn)
ZQWFD1984 2016-07-12
  • 打赏
  • 举报
回复
Button searchButton = (Button) findViewById(R.Id.search_btn.)

最后的括号里是:“R.Id.search_btn." search_btn这后面还有个点?确定能编译过?
cuojue306 2016-07-12
  • 打赏
  • 举报
回复
我去 ,竟然没人回复》》》

62,612

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧