当前位置: 首页>>代码示例>>Java>>正文


Java ListView.setOnTouchListener方法代码示例

本文整理汇总了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;
        }
    });

}
 
开发者ID:icaynia,项目名称:pracler,代码行数:22,代码来源:PlayListActivity.java

示例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;
                }
            });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:ProfilesActivity.java

示例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);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:20,代码来源:QsDetailItemsList.java

示例4: ListViewRefresh

import android.widget.ListView; //导入方法依赖的package包/类
public ListViewRefresh(ListView listView) {
    this.listView = listView;
    listView.setOnTouchListener(this);

}
 
开发者ID:abook23,项目名称:godlibrary,代码行数:6,代码来源:ListViewRefresh.java

示例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();


    }
 
开发者ID:iamjaspreetsingh,项目名称:TrackPlan-app,代码行数:56,代码来源:MainrearrActivity.java

示例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);
}
 
开发者ID:jjuiddong,项目名称:Android-Practice,代码行数:42,代码来源:MainActivity.java


注:本文中的android.widget.ListView.setOnTouchListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。