讨论一下OnPageChangeListener 有几个页面,第一个页面全是layout形式的Button,启动进入第一个页面时点击Button是没有反应的,当滑动页面再回到第一页面,点击就有效了!很纳闷,就将点击后要执行的代码放到OnPageChangeListener里面,这样一来运行不起来,这是什么缘故,有什么解决的方法?android OnPageChangeListener 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 第一个页面时点击Button是没有反应的??为什么?获取不到焦点吗 第一个页面时点击Button是没有反应的??为什么?获取不到焦点吗焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效 第一个页面时点击Button是没有反应的??为什么?获取不到焦点吗焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效你是点击Button然后里面的代码不执行吗? 第一个页面时点击Button是没有反应的??为什么?获取不到焦点吗焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效你是点击Button然后里面的代码不执行吗?对,只有切换到第二页面再返回,点击才能执行!代码没有出错,也能运行! 第一个页面时点击Button是没有反应的??为什么?获取不到焦点吗焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效你是点击Button然后里面的代码不执行吗?对,只有切换到第二页面再返回,点击才能执行!代码没有出错,也能运行!不清楚....你试试这样写呢 <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="你的方法" android:text="button" /> 第一个页面时点击Button是没有反应的??为什么?获取不到焦点吗焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效你是点击Button然后里面的代码不执行吗?对,只有切换到第二页面再返回,点击才能执行!代码没有出错,也能运行!不清楚....你试试这样写呢 <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="你的方法" android:text="button" /><LinearLayout android:id="@+id/setting" android:layout_width="108dp" android:background="@drawable/layout_selector" android:layout_height="108dp" android:clickable="true" android:layout_marginLeft="5dp" android:orientation="vertical" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="30dp" android:background="@drawable/setting" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="@string/setting" /> </LinearLayout> 放到PagerAdapter的instantiateItem进行初始化即可 求助 有关于客户端与服务器通信安全问题 如何彻底屏蔽“输入法”。 android游戏图片拼接的问题 ImageSwitcher切换长宽比例不同的图片时不上下左右居中? 100分 Android SeekBar问题 关于Android内置的搜索框 简单问题,怎么在非Activity类里执行安装程序的操作 垂直滚动的TEXTVIEW文本 设置surfaceview大小后显示视频上边黑边下边灰边 android创建数据库问题 asmack+openfire+spark 传文件问题 android客户端与服务器端的问题
焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效
焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效
你是点击Button然后里面的代码不执行吗?
焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效
你是点击Button然后里面的代码不执行吗?
对,只有切换到第二页面再返回,点击才能执行!代码没有出错,也能运行!
焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效
你是点击Button然后里面的代码不执行吗?
对,只有切换到第二页面再返回,点击才能执行!代码没有出错,也能运行!
不清楚....
你试试这样写呢
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="你的方法"
android:text="button" />
焦点是有获取到的,点击后(Selector)有变化,就是进不了下一步,我用是监听整个layout来作按钮的,设置了Selector,当时点击没有变化,就在layout里添加了android:clickable="true",点击就有变化但点击无效,只有切换到第二页面再返回点击才有效
你是点击Button然后里面的代码不执行吗?
对,只有切换到第二页面再返回,点击才能执行!代码没有出错,也能运行!
不清楚....
你试试这样写呢
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="你的方法"
android:text="button" /><LinearLayout
android:id="@+id/setting"
android:layout_width="108dp"
android:background="@drawable/layout_selector"
android:layout_height="108dp"
android:clickable="true"
android:layout_marginLeft="5dp"
android:orientation="vertical" > <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:background="@drawable/setting" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/setting" />
</LinearLayout>