本文整理了Java中android.widget.ListView.setOnTouchListener()
方法的一些代码示例,展示了ListView.setOnTouchListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.setOnTouchListener()
方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:setOnTouchListener
暂无
代码示例来源:origin: TommyLemon/APIJSON
lvEditTextInfo.setOnTouchListener(new View.OnTouchListener() {
@SuppressLint("ClickableViewAccessibility")
@Override
代码示例来源:origin: TommyLemon/Android-ZBLibrary
lvEditTextInfo.setOnTouchListener(new View.OnTouchListener() {
@SuppressLint("ClickableViewAccessibility")
@Override
代码示例来源:origin: daimajia/AndroidSwipeLayout
mListView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
代码示例来源:origin: com.nhaarman.listviewanimations/lib-manipulation
@Override
public void setOnTouchListener(final OnTouchListener onTouchListener) {
if (onTouchListener instanceof SwipeTouchListener) {
return;
}
super.setOnTouchListener(onTouchListener);
}
代码示例来源:origin: vanilla-music/vanilla
/**
* Register a view for long click observation.
*
* @param view the view to listen for long clicks
*/
public void registerForOnItemLongClickListener(ListView view) {
view.setOnItemLongClickListener(this);
view.setOnTouchListener(this);
}
代码示例来源:origin: BuildmLearn/BuildmLearn-Toolkit-Android
private void handleListViewListeners() {
listViewA.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;
}
});
listViewB.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
//Left empty
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
View v = view.getChildAt(0);
if (v != null)
listViewA.setSelectionFromTop(firstVisibleItem, v.getTop());
}
});
}
代码示例来源:origin: stackoverflow.com
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
ListView containerList = (ListView) findViewById(R.id.containerList);
containerList.setAdapter(new DummyGridsAdapter(this));
containerList.setOnTouchListener(mContainerListOnTouchListener);
}
private View.OnTouchListener mContainerListOnTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
View itemView = ((ListView) view).getChildAt(0);
int top = itemView.getTop();
if (Math.abs(top) >= itemView.getHeight() / 2) {
top = itemView.getHeight() - Math.abs(top);
}
((ListView) view).smoothScrollBy(top, 400);
}
return false;
}
};
代码示例来源:origin: Rachel-Ding/Android-Tiny-Projects
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
//四个参数分别代表着ViewGroup(PullRefreshView)在整个界面上的上下左右边框
super.onLayout(changed, l, t, r, b);
if (!havelayout && changed) {
refreshHeight = -refreshView.getHeight();//刷新域高度(转为相反数)
refreshLayoutParams = (MarginLayoutParams) refreshView.getLayoutParams();
refreshLayoutParams.topMargin = refreshHeight;
listView = (ListView) getChildAt(1);//该ViewGroup中的第二个view
listView.setOnTouchListener(this);
havelayout = true;
}
}
代码示例来源:origin: fr3ts0n/AndrOBD
@Override
public void setContentView(View view)
{
super.setContentView(view);
getListView().setOnTouchListener(toolbarAutoHider);
}
代码示例来源:origin: Meituan-Dianping/Shield
private void initListView() {
listView = new ListView(this);
listView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
hideKeyboard(searchBtnText);
}
return false;
}
});
agentMapAdapter = new AgentMapAdapter(getApplicationContext(), listViewList);
listView.setAdapter(agentMapAdapter);
searchContent.addView(listView);
this.listViewList.clear();
}
代码示例来源:origin: stackoverflow.com
final ListView listView = (ListView) view.findViewById(android.R.id.list);
listView.setOnTouchListener(new OnTouchListener() {
代码示例来源:origin: huangfangyi/FanXin
protected void onMessageListInit(){
messageList.init(toChatUsername, chatType, chatFragmentHelper != null ?
chatFragmentHelper.onSetCustomChatRowProvider() : null);
setListItemClickListener();
messageList.getListView().setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
hideKeyboard();
inputMenu.hideExtendMenuContainer();
return false;
}
});
isMessageListInited = true;
}
代码示例来源:origin: Vegen/SmartCampus
protected void onMessageListInit(){
messageList.init(toChatUsername, chatType, chatFragmentHelper != null ?
chatFragmentHelper.onSetCustomChatRowProvider() : null);
setListItemClickListener();
messageList.getListView().setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
hideKeyboard();
inputMenu.hideExtendMenuContainer();
return false;
}
});
isMessageListInited = true;
}
代码示例来源:origin: easemob/livestream_demo_android
protected void onMessageListInit(){
messageList.init(toChatUsername, chatType, chatFragmentHelper != null ?
chatFragmentHelper.onSetCustomChatRowProvider() : null);
setListItemClickListener();
messageList.getListView().setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
hideKeyboard();
inputMenu.hideExtendMenuContainer();
return false;
}
});
isMessageListInited = true;
}
代码示例来源:origin: stevenwsg/XSY-University-trade
protected void onMessageListInit(){
messageList.init(toChatUsername, chatType, chatFragmentHelper != null ?
chatFragmentHelper.onSetCustomChatRowProvider() : null);
setListItemClickListener();
messageList.getListView().setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
hideKeyboard();
inputMenu.hideExtendMenuContainer();
return false;
}
});
isMessageListInited = true;
}
代码示例来源:origin: zhangchunbin/HuanXinDemo
protected void onMessageListInit(){
messageList.init(toChatUsername, chatType, chatFragmentHelper != null ?
chatFragmentHelper.onSetCustomChatRowProvider() : null);
setListItemClickListener();
messageList.getListView().setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
hideKeyboard();
inputMenu.hideExtendMenuContainer();
return false;
}
});
isMessageListInited = true;
}
代码示例来源:origin: lzan13/EaseUICustomer
protected void onMessageListInit(){
messageList.init(toChatUsername, chatType, chatFragmentListener != null ?
chatFragmentListener.onSetCustomChatRowProvider() : null);
//设置list item里的控件的点击事件
setListItemClickListener();
messageList.getListView().setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
hideKeyboard();
inputMenu.hideExtendMenuContainer();
return false;
}
});
isMessageListInited = true;
}
代码示例来源:origin: WuXiaolong/WoChat
protected void onMessageListInit() {
messageList.init(toChatUsername, chatType, chatFragmentListener != null ?
chatFragmentListener.onSetCustomChatRowProvider() : null);
//设置list item里的控件的点击事件
setListItemClickListener();
messageList.getListView().setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
hideKeyboard();
inputMenu.hideExtendMenuContainer();
return false;
}
});
isMessageListInited = true;
}
代码示例来源:origin: easemob/kefu-android-demo
protected void onMessageListInit() {
messageList.init(toChatUsername, chatFragmentListener != null ?
chatFragmentListener.onSetCustomChatRowProvider() : null);
//设置list item里的控件的点击事件
setListItemClickListener();
messageList.getListView().setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!inputMenu.isVoiceRecording()){//录音时,点击列表不做操作
hideKeyboard();
inputMenu.hideExtendMenuContainer();
}
return false;
}
});
isMessageListInited = true;
}
代码示例来源:origin: lordi/tickmate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tickmate_list);
RelativeLayout progress = new RelativeLayout(this);
progress.setLayoutParams(new GridView.LayoutParams(GridView.LayoutParams.MATCH_PARENT, 100));
progress.setGravity(Gravity.CENTER);
progress.addView(new ProgressBar(this));
mAdapter = new InfiniteScrollAdapter<>(this,
new TickAdapter(this, null, savedInstanceState), progress);
mAdapter.addListener(this);
mHandler = new Handler();
mListHeader = (TickHeader) findViewById(R.id.list_header);
mListHeader.initialize(this);
mListView = (ListView) findViewById(android.R.id.list);
mListView.setStackFromBottom(true);
mListView.setAdapter(mAdapter);
mListView.setOnTouchListener(mListHeader);
mListView.getEmptyView().setOnClickListener(this);
mListView.getEmptyView().setOnTouchListener(mListHeader);
}
内容来源于网络,如有侵权,请联系作者删除!