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