本文整理汇总了Java中android.widget.ListView.setOnTouchListener方法的典型用法代码示例。如果您正苦于以下问题:Java ListView.setOnTouchListener方法的具体用法?Java ListView.setOnTouchListener怎么用?Java ListView.setOnTouchListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ListView
的用法示例。
在下文中一共展示了ListView.setOnTouchListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: viewInitialize
import android.widget.ListView; //导入方法依赖的package包/类
public void viewInitialize()
{
mainListView = (ListView) findViewById(R.id.listview);
scrollview = (NestedScrollView) findViewById(R.id.scrollview);
mainListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Log.e("PlayListFragment", i+"/"+l);
global.playMusic(Integer.parseInt(playList.get(i)));
}
});
mainListView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event)
{
scrollview.requestDisallowInterceptTouchEvent(true);
return false;
}
});
}
示例2: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PrefStore.setLocale(this);
setContentView(R.layout.activity_profiles);
// ListView Adapter
listView = (ListView) findViewById(R.id.profilesView);
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_single_choice, listItems);
listView.setAdapter(adapter);
// Initialize the Gesture Detector
listView.setOnTouchListener(this);
gd = new GestureDetector(this,
new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onDoubleTap(MotionEvent e) {
finish();
return false;
}
});
}
示例3: QsDetailItemsList
import android.widget.ListView; //导入方法依赖的package包/类
private QsDetailItemsList(LinearLayout view) {
mView = view;
mListView = (ListView) mView.findViewById(android.R.id.list);
mListView.setOnTouchListener(new OnTouchListener() {
// Setting on Touch Listener for handling the touch inside ScrollView
@Override
public boolean onTouch(View v, MotionEvent event) {
// Disallow the touch request for parent scroll on touch of child view
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
mEmpty = mView.findViewById(android.R.id.empty);
mEmpty.setVisibility(View.GONE);
mEmptyText = (TextView) mEmpty.findViewById(android.R.id.title);
mEmptyIcon = (ImageView) mEmpty.findViewById(android.R.id.icon);
mListView.setEmptyView(mEmpty);
}
示例4: ListViewRefresh
import android.widget.ListView; //导入方法依赖的package包/类
public ListViewRefresh(ListView listView) {
this.listView = listView;
listView.setOnTouchListener(this);
}
示例5: rearranging
import android.widget.ListView; //导入方法依赖的package包/类
public void rearranging() {
mListView = (ListView) findViewById(R.id.listrearr);
mAdapter = new MyArrayAdapter(this, R.layout.row_string);
mListView.setAdapter(mAdapter);
mListView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (!mSortable) {
return false;
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
break;
}
case MotionEvent.ACTION_MOVE: {
int position = mListView.pointToPosition((int) event.getX(), (int) event.getY());
if (position < 0) {
break;
}
if (position != mPosition) {
mPosition = position;
mAdapter.remove(mDragString);
mAdapter.insert(mDragString, mPosition);
}
return true;
}
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_OUTSIDE: {
stopDrag();
return true;
}
}
return false;
}
});
DatabaseHandler db1 = new DatabaseHandler(this);
List<Contact> contacts1 = db1.getAllContacts();
}
示例6: onCreate
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ArrayList<String> arData = new ArrayList<String>();
mAdapter = new ArrayAdapter<String>(this, R.layout.support_simple_spinner_dropdown_item, arData);
ListView list = (ListView)findViewById(R.id.logList);
mAdapter.add("ssss");
list.setAdapter(mAdapter);
try {
FileInputStream fis = openFileInput("MousePos.txt");
FileChannel inChannel = fis.getChannel();
final int s = fis.available();
ByteBuffer buff = ByteBuffer.allocate((int)fis.available());
buff.clear();
inChannel.read(buff);
buff.rewind();
final int posSize = s/4;
float[] pos = new float[posSize];
buff.asFloatBuffer().get(pos);
inChannel.close();
for (int i=0; i < posSize; i+=2)
{
mAdapter.add("" + pos[i] + ", " + pos[i+1]);
}
fis.close();
} catch (Exception e) {
System.err.println(e.getMessage());
}
list.setOnTouchListener(this);
}