本文整理匯總了Java中android.widget.ListView.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java ListView.setEnabled方法的具體用法?Java ListView.setEnabled怎麽用?Java ListView.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ListView
的用法示例。
在下文中一共展示了ListView.setEnabled方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUIBusy
import android.widget.ListView; //導入方法依賴的package包/類
private void setUIBusy(Boolean busy) {
mUIBusy = busy;
ListView listView = (ListView) findViewById(R.id.listView);
ProgressBar pbBusy = (ProgressBar) findViewById(R.id.pbBusy);
listView.setEnabled(!busy);
if (busy) {
pbBusy.setVisibility(View.VISIBLE);
} else {
pbBusy.setVisibility(View.INVISIBLE);
}
}
示例2: onCreateView
import android.widget.ListView; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
mPlaylist = "queue";
RelativeLayout main = (RelativeLayout) inflater.inflate(
R.layout.media_picker_activity_playlist, container, false);
activity = getActivity();
mTxt = (TextView) main.findViewById(R.id.nointernet);
listView = (ListView) main.findViewById(android.R.id.list);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
if (!isNetworkAvailable(getActivity())) {
listView.setEnabled(false);
mTxt.setVisibility(View.VISIBLE);
} else
MusicUtils.execute(false, new clickerTask(arg2), true);
}
});
if (!isNetworkAvailable(activity)) {
listView.setEnabled(false);
mTxt.setVisibility(View.VISIBLE);
}
((TouchInterceptor) listView).setDropListener(mDropListener);
((TouchInterceptor) listView).setRemoveListener(mRemoveListener);
IntentFilter f = new IntentFilter();
f.addAction(MediaPlaybackService.META_CHANGED);
f.addAction(MediaPlaybackService.QUEUE_CHANGED);
activity.registerReceiver(mNowPlayingListener, new IntentFilter(f));
mNowPlayingListener.onReceive(activity, new Intent(
MediaPlaybackService.META_CHANGED));
mToken = MusicUtils.bindToService(activity, this);
return main;
}
示例3: onCreate
import android.widget.ListView; //導入方法依賴的package包/類
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
PreferenceManager.getDefaultSharedPreferences(this)
.registerOnSharedPreferenceChangeListener(this);
Intent intent = getIntent();
if (savedInstanceState != null) {
mPlaylist = savedInstanceState.getString("playlist");
called = savedInstanceState.getBoolean("called");
mCenter = savedInstanceState.getBoolean("center");
} else {
mPlaylist = intent.getStringExtra("playlist");
called = intent.getBooleanExtra("called", true);
mCenter = intent.getBooleanExtra("center", false);
}
getWindow().setUiOptions(
ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
if (!called)
ThemeUtils.getAppTheme(this);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
super.onCreate(savedInstanceState);
setContentView(R.layout.media_picker_activity_playlist);
if (!called) {
getActionBar().setDisplayHomeAsUpEnabled(false);
getActionBar().setDisplayShowHomeEnabled(true);
getActionBar().setHomeButtonEnabled(true);
// Initialize part of the UI only if we are not in the
// Nowplaying activity
if (!mPlaylist.equalsIgnoreCase("queue")) {
getActionBar().setTitle(mPlaylist);
InterfaceUtils.setUpFAB(this,
R.drawable.music_playall_holo_dark, (FloatingActionButton) findViewById(R.id.FAB), mFABlistener);
} else
getActionBar().setTitle(R.string.nowplaying_title);
}
activity = this;
mTxt = (TextView) findViewById(R.id.nointernet);
listView = (ListView) findViewById(android.R.id.list);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
if (!isNetworkAvailable(getBaseContext())) {
listView.setEnabled(false);
mTxt.setVisibility(View.VISIBLE);
} else
MusicUtils.execute(false, new clickerTask(arg2), true);
}
});
if (!isNetworkAvailable(this)) {
listView.setEnabled(false);
mTxt.setVisibility(View.VISIBLE);
}
if (!called)
((TouchInterceptor) listView).setDropListener(mDropListener);
((TouchInterceptor) listView).setRemoveListener(mRemoveListener);
IntentFilter f = new IntentFilter();
f.addAction(MediaPlaybackService.META_CHANGED);
f.addAction(MediaPlaybackService.QUEUE_CHANGED);
registerReceiver(mNowPlayingListener, new IntentFilter(f));
mNowPlayingListener.onReceive(this, new Intent(
MediaPlaybackService.META_CHANGED));
mToken = MusicUtils.bindToService(this, this);
}