本文整理汇总了Java中android.view.View.OnTouchListener方法的典型用法代码示例。如果您正苦于以下问题:Java View.OnTouchListener方法的具体用法?Java View.OnTouchListener怎么用?Java View.OnTouchListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.OnTouchListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHapticFeedbackTouchListener
import android.view.View; //导入方法依赖的package包/类
public View.OnTouchListener getHapticFeedbackTouchListener() {
if (mHapticFeedbackTouchListener == null) {
mHapticFeedbackTouchListener = new View.OnTouchListener() {
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent event) {
if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
}
return false;
}
};
}
return mHapticFeedbackTouchListener;
}
示例2: changeTextColorOnTouchListener
import android.view.View; //导入方法依赖的package包/类
/**
* returns OnTouchListener that change color of TextView on touch View.
* @param context
* @param textView TextView to change text color
* @return
*/
public static View.OnTouchListener changeTextColorOnTouchListener(
final Context context, final TextView textView) {
return new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
textView.setTextColor(
ContextCompat.getColor(context, R.color.colorPrimary));
break;
case MotionEvent.ACTION_MOVE:
Rect rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
if (!rect.contains(
v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())) {
textView.setTextColor(Color.BLACK);
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
textView.setTextColor(Color.BLACK);
break;
default: break;
}
return false;
}
};
}
示例3: setOnTouchListener
import android.view.View; //导入方法依赖的package包/类
public ViewHolder setOnTouchListener(int viewId,
View.OnTouchListener listener)
{
View view = getView(viewId);
view.setOnTouchListener(listener);
return this;
}
示例4: StableArrayAdapter
import android.view.View; //导入方法依赖的package包/类
public StableArrayAdapter(Context context, int textViewResourceId,
List<String> objects, View.OnTouchListener listener) {
super(context, textViewResourceId, objects);
mTouchListener = listener;
for (int i = 0; i < objects.size(); ++i) {
mIdMap.put(objects.get(i), i);
}
}
示例5: onTouch
import android.view.View; //导入方法依赖的package包/类
@Test
public void onTouch() throws Exception {
// Given
View.OnTouchListener listener = mock(View.OnTouchListener.class);
// When
BlueTapeDsl
.onTouch(listener)
.bind(view);
// Then
verify(view).setOnTouchListener(listener);
}
示例6: setOnTouchListener
import android.view.View; //导入方法依赖的package包/类
public XViewHolder setOnTouchListener(@IdRes int viewId,
View.OnTouchListener listener) {
View view = getView(viewId);
view.setOnTouchListener(listener);
return this;
}
示例7: setupTouchUIToDismissKeyboard
import android.view.View; //导入方法依赖的package包/类
public void setupTouchUIToDismissKeyboard(View view, View.OnTouchListener onTouchListener, final Integer... exceptIDs) {
ChatSDKUiHelper.setupTouchUIToDismissKeyboard(view, onTouchListener, exceptIDs);
}
示例8: setTouchListenerOnView
import android.view.View; //导入方法依赖的package包/类
private void setTouchListenerOnView(int id, View.OnTouchListener listener) {
layout.findViewById(id).setOnTouchListener(listener);
}
示例9: setOnTouchListener
import android.view.View; //导入方法依赖的package包/类
public BaseViewHolder setOnTouchListener(int viewId, View.OnTouchListener listener) {
View view = getView(viewId);
view.setOnTouchListener(listener);
return this;
}
示例10: setOnTouchListener
import android.view.View; //导入方法依赖的package包/类
public ViewHolder setOnTouchListener(int viewId,
View.OnTouchListener listener) {
View view = getView(viewId);
view.setOnTouchListener(listener);
return this;
}
示例11: setOnItemTouchListener
import android.view.View; //导入方法依赖的package包/类
public SuperRecyclerHolder setOnItemTouchListener(boolean isListener,
@NonNull View.OnTouchListener listener) {
getItemView().setOnTouchListener(isListener ? listener : null);
return this;
}
示例12: setTouchIntercepter
import android.view.View; //导入方法依赖的package包/类
public PopupWindowBuilder setTouchIntercepter(View.OnTouchListener touchIntercepter){
mCustomPopWindow.mOnTouchListener = touchIntercepter;
return this;
}
示例13: setOnInterceptTouchListener
import android.view.View; //导入方法依赖的package包/类
public void setOnInterceptTouchListener(View.OnTouchListener listener) {
mInterceptTouchListener = listener;
}
示例14: setTouchIntercepter
import android.view.View; //导入方法依赖的package包/类
/**
* 设置触摸拦截
* @param touchIntercepter 拦截器
*/
public CustomPopupWindow.PopupWindowBuilder setTouchIntercepter(View.OnTouchListener touchIntercepter) {
this.mCustomPopWindow.mOnTouchListener = touchIntercepter;
return this;
}
示例15: setOnTouchListener
import android.view.View; //导入方法依赖的package包/类
@Override
public void setOnTouchListener(View.OnTouchListener l) {
userTouchListener = l;
}