触摸模式(Touch
mode
)
当用户直接使用keys或trackball与UI进行交互的时候,
必须先使目标控件获取焦点(比如按钮),这样用户才会注意到是什么控件接收输入. 然而如果设备支持触摸手势的话,
用户可能使用触摸屏与UI进行交互, 这个时候就没有必要将目标控件高亮显示了(即,获取焦点).
因此就产生了这样一种交互模式叫"touch
mode
."
对于一个拥有触摸屏功能的设备而言, 一旦用户用手点击屏幕, 设备立刻进入touch
mode
.
这时候被点击的控件只有isFocusableInTouchMode()方法返回true的时候才会
focusable
,
比如EditText控件. 其他可以触摸的控件, 比如按钮, 当被点击的时候不会获取焦点;
它们只是简单地执行onClick事件而已.
任何时候只要用户点击key或滚动trackball, 设备就会退出touch
mode
,并且找一个view将焦点置于其上.
此时用户可以不使用触摸手势了.
touch
mode
在整个系统运行期间都是有效的(在任何activities中). 如果想要查询当前处于何种状态,
你可以调用View#isInTouchMode()来看看当前是否处于touch
mode
.
查询各种常用控件的默认初始状态
isClickable()
isLongClickable()
isFocusable()
isFocusableInTouchMode()
android
.widget.TextView
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
android
.widget.Button
Clickable : true
LongClickable : false
Focusable
: true
FocusableInTouchMode : false
android
.widget.Chronometer
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
android
.widget.DigitalClock
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
android
.widget.EditText
Clickable : true
LongClickable : true
Focusable
: true
FocusableInTouchMode : true
android
.widget.AutoCompleteTextView
Clickable : true
LongClickable : true
Focusable
: true
FocusableInTouchMode : true
android
.widget.CheckBox
Clickable : true
LongClickable : false
Focusable
: true
FocusableInTouchMode : false
android
.inputmethodservice.ExtractEditText
Clickable : true
LongClickable : true
Focusable
: true
FocusableInTouchMode : true
android
.widget.MultiAutoCompleteTextVie
w
Clickable : true
LongClickable : true
Focusable
: true
FocusableInTouchMode : true
android
.widget.RadioButton
Clickable : true
LongClickable : false
Focusable
: true
FocusableInTouchMode : false
android
.widget.ToggleButton
Clickable : true
LongClickable : false
Focusable
: true
FocusableInTouchMode : false
android
.widget.AnalogClock
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
android
.widget.ImageView
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
android
.widget.ImageButton
Clickable : true
LongClickable : false
Focusable
: true
FocusableInTouchMode : false
android
.widget.ZoomButton
Clickable : false
LongClickable : true
Focusable
: true
FocusableInTouchMode : false
android
.widget.ProgressBar
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
android
.widget.SeekBar
Clickable : false
LongClickable : false
Focusable
: true
FocusableInTouchMode : false
android
.widget.RatingBar
Clickable : false
LongClickable : false
Focusable
: true
FocusableInTouchMode : false
android
.view.SurfaceView
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
android
.opengl.GLSurfaceView
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
android
.widget.VideoView
Clickable : false
LongClickable : false
android
.view.ViewStub
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
Layout只测试了LinearLayout,在这里主观臆断地认为其他Layout都和LinearLayout一样
android
.widget.LinearLayout
Clickable : false
LongClickable : false
Focusable
: false
FocusableInTouchMode : false
分享到:
相关推荐
Android左右侧滑第三方架包SlidingMenu用于在项目中添加左右侧滑非常方便简洁,使用的方式也非常简单,架包的源码也一同包含在内,侧滑滑动区域也可以设置自定义的模式,如menu.setTouchModeAbove(SlidingMenu.TOUCH...
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); menu.setShadowWidthRes(R.dimen.shadow_width); menu.setShadowDrawable(R.drawable.shadow); menu.setBehindOffsetRes(R.dimen.slidingmenu_...
Android Silencer Android Silencer is an Android application created in response ... With the touch of a button, vibrate mode is easily swapped to silent mode, and with another press, it is swapped back.
Android Simple Tooltip ...Modal mode (prevents touch in the background) Overlay (darkens the background highlighting the anchor) Customizable arrow Inflatable content from a View or XML layout.
1.2.1 Activity的Launch Mode / 16 1.2.2 Activity的Flags / 27 1.3 Intent Filter的匹配规则 / 28 第2章 IPC机制 / 35 2.1 Android IPC简介 / 35 2.2 Android中的多进程模式 / 36 2.2.1 开启多进程模式...
iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd, less, linuxrc, ln, loadkmap, logread, losetup, lpd, lpq, lpr, ls, lsattr, lsmod, lsof, lspci, lsusb, lzcat, lzma, lzop, lzopcat,...
BifacialView Gradle allprojects { repositories { ... } } dependencies { ...To install the picture ...TouchMode ALL - reacts to the touch in any part of view. DELIMITER - reacts to a touch in the deli
Touch mode Gyroscope mode DisplayMode Glass mode Eye mode Update v1.0(2017-7-31) v1.1(2017-8-22) Remove Carbon and use native SDK UI BaseOn IJKPlayer MD360player4Android Glide StatusBarUtil You...
/ 123 3.1.3 Motion Event和Touch Slop / 125 3.1.4 VelocityT racker、Gesture Detector和Scroller / 126 3.2 View的滑动 / 129 3.2.1 使用scroll To/scroll By / 129 3.2.2 使用动画 / 131 3.2.3 改变布局...
3.1.1. Android Extensions 3.2. Soft API Compatibility 3.2.1. Permissions 3.2.2. Build Parameters 3.2.3. Intent Compatibility 3.2.3.1. Core Application Intents 3.2.3.2. Intent Resolution 3.2.3.3. ...
其实,调节屏幕亮度的场景应用很广,例如很多视频应用都响应touch事件来进行亮度调节。 屏幕亮度调节模式 首先,需要明确屏幕亮度有两种调节模式: Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC:值为1,自动...
实现方法:(需要开启悬浮窗通知权限、允许应用在其他应用上显示) 一.利用headsup 悬挂式Notification,他是5.0中新增的,...FLAGE_NOT_TOUCH_MODE 在此模式下,系统会将当前Window区域以外的单击事件传递给底层的Wind
FUNCTIONS OF GOOGLE NEXUS 4 TOOLKIT V1.3.0 [24TH NOVEMBER 2012] * Install correct adb/fastboot drivers automatically on...* Reboot Phone to Fastboot Mode, Recovery, Android or Download Mode from adb mode
Tired of enabling the screen rotation everytime you want landscape mode? Automatic rotation always rotates the screen in the wrong moment? Then this App is for you! Instead of rotating the screen ...
DSelectorBryant 单选滚动选择器 模组 allprojects { repositories { google() jcenter() maven { url ' ... } } ... public class MainActivity extends AppCompatActivity { DSelectorPopup dSelectorPopup;...
单选滚动选择器、diy丰富、有阻尼效果、简单美观、触摸or点击模式 (Rolling Selector, Diy Rich, Damping Effect, Simple and Beautiful, Touch or Click Mode) Github地址 YangsBryant/DSelectorBryant (Github排版...
# frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \ # frameworks/native/data/etc/android....
ctp_screen_max_x/_y : resolution of touch panel ;ctp_revert_x/_y_flag : whether need to revert x/y ;ctp_exchange_x_y_flag: whether need to exchange the value of x and y ;ctp_int_port : port for tp's ...
* Determines speed during touch scrolling */ private VelocityTracker mVelocityTracker; private int mMinimumVelocity; private int mMaximumVelocity; private float mBaseLineFlingVelocity; ...
app:state_drawable_mode="center" //设置drawable的height app:state_drawable_height="30dp" //设置drawable的width app:state_drawable_width="30dp" //设置drawble相对于基础位置左边的距离 ...