當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。