本文整理匯總了Java中android.widget.ListView.setOnKeyListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ListView.setOnKeyListener方法的具體用法?Java ListView.setOnKeyListener怎麽用?Java ListView.setOnKeyListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ListView
的用法示例。
在下文中一共展示了ListView.setOnKeyListener方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.widget.ListView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setFlags(LayoutParams.FLAG_NOT_TOUCH_MODAL, LayoutParams.FLAG_NOT_TOUCH_MODAL);
getWindow().setFlags(LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
// Notify the application that the activity has started
CustomApplication app = (CustomApplication)getApplication();
app.setAutoScraperActive(true);
mScraper = new Scraper(this);
// Check if the intent which created this activity contains a folder path
Uri folderUri = getIntent().getData();
if (folderUri != null) {
mFolderMode = true;
// FIXME: this is broken for smb:// files
mFolderPath = folderUri.getPath();
if (DBG) Log.d(TAG, "onCreate : search in folder " + mFolderPath);
}
else {
mFolderMode = false;
mFolderPath = null;
if (DBG) Log.d(TAG, "onCreate : search in the full database");
}
setContentView(R.layout.auto_scraper_main);
mMainView = findViewById(R.id.main_view);
mAbortButton = (Button)findViewById(R.id.abort_button);
mAbortButton.setOnClickListener(this);
mExitButton = (Button)findViewById(R.id.exit_button);
mExitButton.setOnClickListener(this);
mListView = (ListView) findViewById(R.id.list_items);
mListView.setTextFilterEnabled(true);
mListView.setCacheColorHint(0);
mListView.setSelector(R.drawable.list_selector_no_background);
mListView.setOnCreateContextMenuListener(this);
mListView.setOnScrollListener(this);
mListView.setOnKeyListener(this);
mActivityFileCursor = getFileListCursor();
getColumnIndices(mActivityFileCursor);
buildFileProperties(mActivityFileCursor);
mAdapterFileCursor = buildAdapterCursor(mActivityFileCursor);
mAdapter = new AutoScraperAdapter(getApplication(), this,
R.layout.auto_scraper_item,
mAdapterFileCursor);
mListView.setAdapter(mAdapter);
/*
if (!mListView.isInTouchMode()) {
// The application is remotely controlled => set the focus by default
// on the Cancel button so that the user can abort the task with a
// single click instead of navigating the full ListView
mAbortButton.requestFocus();
}
*/
mEmptyView = buildEmptyView();
mListView.setEmptyView(mEmptyView);
updateControlButtons(false);
if (mFileCount > 0) {
mMainView.setVisibility(View.VISIBLE);
}
else {
mMainView.setVisibility(View.GONE);
}
mIsLargeScreen = getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE)|| TVUtils.isTV(this);
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "AutoScraperActivity");
}