当前位置: 首页>>代码示例>>Java>>正文


Java ListView.getContext方法代码示例

本文整理汇总了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;
}
 
开发者ID:stephenmcgruer,项目名称:simple-upnp,代码行数:22,代码来源:ServerBrowserFragment.java

示例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());
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:11,代码来源:SwipeDismissListViewTouchListener.java

示例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;
}
 
开发者ID:stephenmcgruer,项目名称:simple-upnp,代码行数:15,代码来源:FileBrowserFragment.java

示例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();
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:33,代码来源:TileOrderActivity.java

示例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);
}
 
开发者ID:Lazyeraser,项目名称:DereHelper,代码行数:10,代码来源:Utils.java


注:本文中的android.widget.ListView.getContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。