本文整理了Java中android.widget.ListView.getContext()
方法的一些代码示例,展示了ListView.getContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.getContext()
方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:getContext
暂无
代码示例来源:origin: joyoyao/superCleanMaster
protected ListViewBuilder(final ListView listView) {
super(listView.getContext());
mListView = listView;
}
代码示例来源:origin: UweTrottmann/SeriesGuide
/**
* This simple implementation gets a new view of the list item currently shown at ListView
* <code>position</code> from the adapter and triggers a short vibration.
*/
@Override
public View onCreateFloatView(int position) {
// short vibrate to signal drag has started
Vibrator v = (Vibrator) listView.getContext().getSystemService(Context.VIBRATOR_SERVICE);
if (v != null) {
v.vibrate(10);
}
// grab a new view for the item from the adapter
return listView.getAdapter().getView(position, null, listView);
}
代码示例来源:origin: hudomju/android-swipe-to-dismiss-undo
@Override
public Context getContext() {
return mListView.getContext();
}
代码示例来源:origin: stackoverflow.com
Cursor aislescsr = shopperdb.getAislesPerShopAsCursor(csr.getInt(ShopperDBHelper.SHOPS_COLUMNN_ID_INDEX));
final ListView lv = (ListView) findViewById(R.id.aalbclv01);
AislesCursorAdapter aisleadapter = new AislesCursorAdapter(lv.getContext(), aislescsr, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
currentaca = aisleadapter;
lv.setAdapter(aisleadapter);
代码示例来源:origin: FreedomZZQ/YouJoin-Android
public FriendListAdapter(ListView view, List<FriendsInfo.FriendsEntity> data){
if(data == null){
data = new ArrayList<>();
}
Collections.sort(data);
this.dataList = data;
this.listView = view;
context = view.getContext();
inflater = LayoutInflater.from(context);
}
代码示例来源:origin: stackoverflow.com
Cursor aislescsr = shopperdb.getAislesPerShopAsCursor(csr.getInt(ShopperDBHelper.SHOPS_COLUMNN_ID_INDEX));
ListView lv = (ListView) findViewById(R.id.aislelist_listview);
AislesCursorAdapter aisleadapter = new AislesCursorAdapter(lv.getContext(), aislescsr, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
lv.setAdapter(aisleadapter);
代码示例来源:origin: stackoverflow.com
ListView dialog_ListView = (ListView)dialog.findViewById(R.id.list);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(dialog_ListView.getContext(),android.R.layout.simple_list_item_1, comment11);
dialog_ListView.setAdapter(adapter);
代码示例来源:origin: ajnas/WiFiPS
/**
* Constructs a new swipe-to-dismiss touch listener for the given list view.
*
* @param listView The list view whose items should be dismissable.
* @param callbacks The callback to trigger when the user has indicated that she would like to
* dismiss one or more list items.
*/
public SwipeDismissListViewTouchListener(ListView listView, DismissCallbacks callbacks) {
ViewConfiguration vc = ViewConfiguration.get(listView.getContext());
mSlop = vc.getScaledTouchSlop();
mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16;
mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
mAnimationTime = listView.getContext().getResources().getInteger(
android.R.integer.config_shortAnimTime);
mListView = listView;
mCallbacks = callbacks;
}
代码示例来源:origin: wirasetiawan29/Android
/**
* Constructs a new swipe-to-dismiss touch listener for the given list view.
*
* @param listView The list view whose items should be dismissable.
* @param callbacks The callback to trigger when the user has indicated that she would like to
* dismiss one or more list items.
*/
public SwipeDismissListViewTouchListener(ListView listView, DismissCallbacks callbacks) {
ViewConfiguration vc = ViewConfiguration.get(listView.getContext());
mSlop = vc.getScaledTouchSlop();
mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16;
mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
mAnimationTime = listView.getContext().getResources().getInteger(
android.R.integer.config_shortAnimTime);
mListView = listView;
mCallbacks = callbacks;
}
代码示例来源:origin: stripe/stripe-android
public ListViewController(@NonNull ListView listView) {
final Context context = listView.getContext();
mResources = context.getResources();
mAdapter = new SimpleAdapter(
context,
mCardTokens,
R.layout.list_item_layout,
new String[]{"last4", "tokenId"},
new int[]{R.id.last4, R.id.tokenId});
listView.setAdapter(mAdapter);
}
代码示例来源:origin: stackoverflow.com
public void addBlankSpace(ListView listView)
{
Space space = new Space(listView.getContext());
space.setMinimumHeight(Core.dpToPx(50));
listView.addFooterView(space);
}
代码示例来源:origin: fashare2015/NoViewHolder
@Override
protected void onInitView(ListView targetView, BindListView annotation, List value) {
if(value == null)
value = new ArrayList();
targetView.setAdapter(new NoListViewAdapter<>(targetView.getContext(), annotation.layout(), value));
}
代码示例来源:origin: madreain/AndroidDream
@Override
public boolean handleSetAdapter(View contentView, ILoadMoreViewFactory.ILoadMoreView loadMoreView, OnClickListener onClickLoadMoreListener) {
final ListView listView = (ListView) contentView;
mListView = listView;
boolean hasInit = false;
if (loadMoreView != null) {
final Context context = listView.getContext().getApplicationContext();
loadMoreView.init(new ILoadMoreViewFactory.FootViewAdder() {
@Override
public View addFootView(int layoutId) {
View view = LayoutInflater.from(context).inflate(layoutId, listView, false);
mFooter = view;
return addFootView(view);
}
@Override
public View addFootView(View view) {
listView.addFooterView(view);
return view;
}
}, onClickLoadMoreListener);
hasInit = true;
}
return hasInit;
}
代码示例来源:origin: stackoverflow.com
public void usegetPackageInfo(){
//
final ListView lw = (ListView) findViewById(R.id.listView1);
PackageManager p = lw.getContext().getPackageManager();
final List<PackageInfo> appinstall =
p.getInstalledPackages(PackageManager.GET_PERMISSIONS |
PackageManager.GET_PROVIDERS);
final TextView tw = (TextView) findViewById(R.id.textView1);
Iterator it = appinstall.iterator();
while (it.hasNext()) {
PackageInfo rf = (PackageInfo) it.next();
tw.append(rf.toString());
}
}
代码示例来源:origin: Hitomis/SortRichEditor
public SelectPopupWindow(ListView contentView, int width, int height, List<PhotoPack> photoPacks) {
super(contentView, width, height);
popupView = contentView;
activity = (Activity) contentView.getContext();
dataList = photoPacks;
initPopupWindow();
initView();
}
代码示例来源:origin: vanilla-music/vanilla
/**
* This simple implementation creates a Bitmap copy of the
* list item currently shown at ListView <code>position</code>.
*/
@Override
public View onCreateFloatView(int position) {
// Guaranteed that this will not be null? I think so. Nope, got
// a NullPointerException once...
View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() - mListView.getFirstVisiblePosition());
if (v == null) {
return null;
}
v.setPressed(false);
// Create a copy of the drawing cache so that it does not get
// recycled by the framework when the list tries to clean up memory
//v.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
v.setDrawingCacheEnabled(true);
mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
v.setDrawingCacheEnabled(false);
if (mImageView == null) {
mImageView = new ImageView(mListView.getContext());
}
mImageView.setBackgroundColor(mFloatBGColor);
mImageView.setPadding(0, 0, 0, 0);
mImageView.setImageBitmap(mFloatBitmap);
mImageView.setLayoutParams(new ViewGroup.LayoutParams(v.getWidth(), v.getHeight()));
return mImageView;
}
代码示例来源:origin: yukuku/androidbible
/**
* This simple implementation creates a Bitmap copy of the
* list item currently shown at ListView <code>position</code>.
*/
@Override
public View onCreateFloatView(int position) {
// Guaranteed that this will not be null? I think so. Nope, got
// a NullPointerException once...
View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() - mListView.getFirstVisiblePosition());
if (v == null) {
return null;
}
v.setPressed(false);
// Create a copy of the drawing cache so that it does not get
// recycled by the framework when the list tries to clean up memory
//v.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
v.setDrawingCacheEnabled(true);
mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
v.setDrawingCacheEnabled(false);
if (mImageView == null) {
mImageView = new ImageView(mListView.getContext());
}
mImageView.setBackgroundColor(mFloatBGColor);
mImageView.setPadding(0, 0, 0, 0);
mImageView.setImageBitmap(mFloatBitmap);
mImageView.setLayoutParams(new ViewGroup.LayoutParams(v.getWidth(), v.getHeight()));
return mImageView;
}
代码示例来源:origin: namndbka/QDict
/**
* This simple implementation creates a Bitmap copy of the list item
* currently shown at ListView <code>position</code>.
*/
@Override
public View onCreateFloatView(int position) {
// Guaranteed that this will not be null? I think so. Nope, got
// a NullPointerException once...
View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() - mListView.getFirstVisiblePosition());
if (v == null) {
return null;
}
v.setPressed(false);
// Create a copy of the drawing cache so that it does not get
// recycled by the framework when the list tries to clean up memory
// v.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
v.setDrawingCacheEnabled(true);
mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
v.setDrawingCacheEnabled(false);
if (mImageView == null) {
mImageView = new ImageView(mListView.getContext());
}
mImageView.setBackgroundColor(mFloatBGColor);
mImageView.setPadding(0, 0, 0, 0);
mImageView.setImageBitmap(mFloatBitmap);
mImageView.setLayoutParams(new ViewGroup.LayoutParams(v.getWidth(), v.getHeight()));
return mImageView;
}
代码示例来源:origin: devinhu/androidone
/**
* This simple implementation creates a Bitmap copy of the
* list item currently shown at ListView <code>position</code>.
*/
@Override
public View onCreateFloatView(int position) {
// Guaranteed that this will not be null? I think so. Nope, got
// a NullPointerException once...
View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() - mListView.getFirstVisiblePosition());
if (v == null) {
return null;
}
v.setPressed(false);
// Create a copy of the drawing cache so that it does not get
// recycled by the framework when the list tries to clean up memory
//v.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
v.setDrawingCacheEnabled(true);
mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
v.setDrawingCacheEnabled(false);
if (mImageView == null) {
mImageView = new ImageView(mListView.getContext());
}
mImageView.setBackgroundColor(mFloatBGColor);
mImageView.setPadding(0, 0, 0, 0);
mImageView.setImageBitmap(mFloatBitmap);
mImageView.setLayoutParams(new ViewGroup.LayoutParams(v.getWidth(), v.getHeight()));
return mImageView;
}
代码示例来源:origin: yomguy/servestream
/**
* This simple implementation creates a Bitmap copy of the
* list item currently shown at ListView <code>position</code>.
*/
@Override
public View onCreateFloatView(int position) {
// Guaranteed that this will not be null? I think so. Nope, got
// a NullPointerException once...
View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() - mListView.getFirstVisiblePosition());
if (v == null) {
return null;
}
v.setPressed(false);
// Create a copy of the drawing cache so that it does not get
// recycled by the framework when the list tries to clean up memory
//v.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
v.setDrawingCacheEnabled(true);
mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
v.setDrawingCacheEnabled(false);
if (mImageView == null) {
mImageView = new ImageView(mListView.getContext());
}
mImageView.setBackgroundColor(mFloatBGColor);
mImageView.setPadding(0, 0, 0, 0);
mImageView.setImageBitmap(mFloatBitmap);
mImageView.setLayoutParams(new ViewGroup.LayoutParams(v.getWidth(), v.getHeight()));
return mImageView;
}
内容来源于网络,如有侵权,请联系作者删除!