當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。