本文整理汇总了Java中android.widget.ListView.getContext方法的典型用法代码示例。如果您正苦于以下问题:Java ListView.getContext方法的具体用法?Java ListView.getContext怎么用?Java ListView.getContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ListView
的用法示例。
在下文中一共展示了ListView.getContext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import android.widget.ListView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
RelativeLayout relativeLayoutView = (RelativeLayout) inflater.inflate(R.layout.fragment_server_browser, container, false);
ListView serverListView = (ListView) relativeLayoutView.findViewById(R.id.server_browser_list);
mServerListAdapter =
new ArrayAdapter<>(serverListView.getContext(), R.layout.fragment_server_browser_item);
serverListView.setAdapter(mServerListAdapter);
serverListView.setOnItemClickListener(this);
mBookmarkTextView = (TextView) relativeLayoutView.findViewById(R.id.bookmarks_text);
ListView bookmarkListView = (ListView) relativeLayoutView.findViewById(R.id.bookmarks_list);
mBookmarkListAdapter =
new ArrayAdapter<>(bookmarkListView.getContext(), R.layout.fragment_server_browser_item);
bookmarkListView.setAdapter(mBookmarkListAdapter);
bookmarkListView.setOnItemClickListener(this);
return relativeLayoutView;
}
示例2: SwipeDismissListViewTouchListener
import android.widget.ListView; //导入方法依赖的package包/类
public SwipeDismissListViewTouchListener(ListView listView, DismissCallbacks callbacks) {
ViewConfiguration vc = ViewConfiguration.get(listView.getContext());
this.mSlopX = vc.getScaledTouchSlop() * 2;
this.mSlopY = vc.getScaledTouchSlop();
this.mAnimationTime = (long) listView.getContext().getResources().getInteger(17694720);
this.mListView = listView;
this.mCallbacks = callbacks;
this.mSwipeToDismissViewResourceId = -1;
this.gestureDetector = new GestureDetector(listView.getContext(), new GestureRecognizer());
}
示例3: onCreateView
import android.widget.ListView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
ListView view = (ListView) inflater.inflate(R.layout.fragment_file_browser, container, false);
Context context = view.getContext();
mFileBrowserAdapter = new FileBrowserAdapter(this, context, R.layout.fragment_file_browser_item);
mFileBrowserAdapter.add(FileBrowserAdapter.ListItem.PREVIOUS_CONTAINER_LIST_ITEM);
view.setAdapter(mFileBrowserAdapter);
view.setOnItemClickListener(this);
return view;
}
示例4: showMenu
import android.widget.ListView; //导入方法依赖的package包/类
void showMenu(final ListView listView, final View anchorView) {
final PopupMenu menu = new PopupMenu(listView.getContext(), anchorView);
menu.inflate(R.menu.tile_menu);
menu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.tile_dual:
dual = !dual;
break;
case R.id.tile_locked:
locked = !locked;
if (locked) {
secured = true;
lockedOnly = false;
}
break;
case R.id.tile_locked_only:
lockedOnly = !lockedOnly;
break;
case R.id.tile_secured:
secured = !secured;
break;
}
updateMenu(menu.getMenu());
listView.invalidateViews();
return true;
}
});
updateMenu(menu.getMenu());
menu.show();
}
示例5: setLVEmptyView
import android.widget.ListView; //导入方法依赖的package包/类
public static void setLVEmptyView(ListView listView, String txt) {
TextView emptyView = new TextView(listView.getContext());
emptyView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
emptyView.setText(txt);
emptyView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
emptyView.setVisibility(View.GONE);
((ViewGroup) listView.getParent()).addView(emptyView);
listView.setEmptyView(emptyView);
}