當前位置: 首頁>>代碼示例>>Java>>正文


Java RecyclerView.setNestedScrollingEnabled方法代碼示例

本文整理匯總了Java中android.support.v7.widget.RecyclerView.setNestedScrollingEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.setNestedScrollingEnabled方法的具體用法?Java RecyclerView.setNestedScrollingEnabled怎麽用?Java RecyclerView.setNestedScrollingEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.widget.RecyclerView的用法示例。


在下文中一共展示了RecyclerView.setNestedScrollingEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void initView() {
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        supportActionBar.hide();
    }
    searchbarview = (SearchBarView) findViewById(R.id.searchbarview);
    searchbarview.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            // enter search activity
            Toast.makeText(MainActivity.this, "enter search activity", Toast.LENGTH_SHORT).show();
        }
    });
    AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appbarlayout);
    appBarLayout.addOnOffsetChangedListener(this);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setVerticalScrollBarEnabled(true);
    mRecyclerView.setNestedScrollingEnabled(false);
    mRecyclerView.setAdapter(new MyAdapter());
}
 
開發者ID:yuqirong,項目名稱:FlexibleSearchBar,代碼行數:23,代碼來源:MainActivity.java

示例2: initUi

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void initUi() {
    initializeToolbar();

    RecyclerView recyclerViewLocations = (RecyclerView) findViewById(R.id.recycler_view_locations);
    recyclerViewLocations.setHasFixedSize(true);
    recyclerViewLocations.setNestedScrollingEnabled(false);
    final LinearLayoutManager mLayoutManager = new LinearLayoutManager(
            this);
    mLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    recyclerViewLocations.setLayoutManager(mLayoutManager);

    locationsList = new LinkedList<>();
    for (int i = 0; i < 5; i++) {
        LocationItem locationItem = new LocationItem();
        locationsList.add(locationItem);
    }

    locationsAdapter = new EasyRecyclerAdapter<>(this, FeaturedEventsAdapter.class, locationsList);
    recyclerViewLocations.setAdapter(locationsAdapter);
}
 
開發者ID:vipulyaara,項目名稱:betterHotels,代碼行數:21,代碼來源:HotelDetailActivity.java

示例3: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceStatus) {
    Log.d(TAG, "onCreate()");
    setContentView(R.layout.activity_list_points);
    super.onCreate(savedInstanceStatus);
    
    // Recover Widgets
    recyclerViewPoints = (RecyclerView) findViewById(R.id.recyclerViewPoints);
    recyclerViewPoints.setNestedScrollingEnabled(false); // Smooth scrolling!
    linearLayoutManager = new LinearLayoutManager(this);
    recyclerViewPoints.setLayoutManager(linearLayoutManager);
    
    // Setup Toolbar
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    try {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    } catch (NullPointerException e) {
        Log.e("TAG", e.toString());
    }
    
    loadBackdrop(R.id.backdrop, R.drawable.header_list);
}
 
開發者ID:stefanonicolai,項目名稱:AstronomyTourPadova,代碼行數:24,代碼來源:ListPointsActivity.java

示例4: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceStatus) {
    Log.d(TAG, "onCreate()");
    setContentView(R.layout.activity_list_achievements);
    super.onCreate(savedInstanceStatus);
    
    // Recover Widgets
    recyclerViewAchievements = (RecyclerView) findViewById(R.id.recyclerViewAchievements);
    recyclerViewAchievements.setNestedScrollingEnabled(false); // Smooth scrolling!
    linearLayoutManager = new LinearLayoutManager(this);
    recyclerViewAchievements.setLayoutManager(linearLayoutManager);

    //adapterAchievements.notifyDataSetChanged();

    loadBackdrop(R.id.backdrop, R.drawable.header_achievements);
    
    
    // Setup Toolbar
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    try {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    } catch (NullPointerException e) {
        Log.e("TAG", e.toString());
    }
}
 
開發者ID:stefanonicolai,項目名稱:AstronomyTourPadova,代碼行數:27,代碼來源:ListAchievementsActivity.java

示例5: setupRecyclerView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void setupRecyclerView() {
    recyclerViewLocations = (RecyclerView) findViewById(R.id.recycler_view_locations);
    recyclerViewLocations.setHasFixedSize(true);
    recyclerViewLocations.setNestedScrollingEnabled(false);
    final LinearLayoutManager mLayoutManager = new LinearLayoutManager(
            this);
    mLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    recyclerViewLocations.setLayoutManager(mLayoutManager);

    locationsList = new LinkedList<>();
    for (int i = 0; i < 8; i++) {
        LocationItem locationItem = new LocationItem();
        locationsList.add(locationItem);
    }

    locationsAdapter = new EasyRecyclerAdapter<>(this, LocationsAdapter.class, locationsList);
    recyclerViewLocations.setAdapter(locationsAdapter);

    setupOffers();
}
 
開發者ID:vipulyaara,項目名稱:betterHotels,代碼行數:21,代碼來源:MainActivity.java

示例6: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    slidingRootNav = new SlidingRootNavBuilder(this)
            .withToolbarMenuToggle(toolbar)
            .withMenuOpened(false)
            .withContentClickableWhenMenuOpened(false)
            .withSavedState(savedInstanceState)
            .withMenuLayout(R.layout.menu_left_drawer)
            .inject();

    screenIcons = loadScreenIcons();
    screenTitles = loadScreenTitles();

    DrawerAdapter adapter = new DrawerAdapter(Arrays.asList(
            createItemFor(POS_DASHBOARD).setChecked(true),
            createItemFor(POS_ACCOUNT),
            createItemFor(POS_MESSAGES),
            createItemFor(POS_CART),
            new SpaceItem(48),
            createItemFor(POS_LOGOUT)));
    adapter.setListener(this);

    RecyclerView list = findViewById(R.id.list);
    list.setNestedScrollingEnabled(false);
    list.setLayoutManager(new LinearLayoutManager(this));
    list.setAdapter(adapter);

    adapter.setSelected(POS_DASHBOARD);
}
 
開發者ID:yarolegovich,項目名稱:SlidingRootNav,代碼行數:36,代碼來源:SampleActivity.java

示例7: showFavouriteList

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void showFavouriteList(){
        RecyclerView favourite = (RecyclerView) rootView.findViewById(R.id.favourite_recycler_view);
        GridLayoutManager layoutManager = new GridLayoutManager(getActivity(),3);
        favourite.setLayoutManager(layoutManager);
//        favourite.setItemAnimator(new DefaultItemAnimator());
        FavouriteListAdapter adapter = new FavouriteListAdapter();
        favourite.setAdapter(adapter);
        //與Scrollview滑動衝突
        favourite.setNestedScrollingEnabled(false);
        favourite.setHasFixedSize(true);
    }
 
開發者ID:htqqdd,項目名稱:music_player,代碼行數:12,代碼來源:RecommendFragment.java

示例8: initView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void initView() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
    }

    mView_Coordinator = findViewById(R.id.coordinator);
    mView_SubjectName = findViewById(R.id.week_lesson_detail_subject_name);
    mView_SubjectArrow = findViewById(R.id.arrow);
    mView_Weekday = findViewById(R.id.week_lesson_detail_weekday);
    mView_Repeat = findViewById(R.id.week_lesson_detail_repeat);
    mView_Day = findViewById(R.id.week_lesson_detail_day);
    mView_FABMenu = findViewById(R.id.fab_menu_1);
    FloatingActionButton addDayLesson = findViewById(R.id.fab_action_1);
    FloatingActionButton editWeekLesson = findViewById(R.id.fab_action_2);
    addDayLesson.setVisibility(View.VISIBLE);
    editWeekLesson.setVisibility(View.VISIBLE);
    addDayLesson.setLabelText(mResources.getString(R.string.add_day_lesson));
    editWeekLesson.setLabelText(mResources.getString(R.string.edit_week_lesson));
    editWeekLesson.setImageResource(R.drawable.ic_edit_white_24dp);

    RecyclerView mView_RecyclerView = findViewById(R.id.recycle_view);
    mView_RecyclerView.setNestedScrollingEnabled(false);
    mView_RecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new DayLessonAdapter(mContext, new ArrayList<DayLesson>(), mColorText, mColorBackground);
    @SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, mView_RecyclerView);
    mView_RecyclerView.setAdapter(animatorAdapter);

    ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
    ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
    touchHelper.attachToRecyclerView(mView_RecyclerView);

    registerForContextMenu(mView_SubjectArrow);
    mView_SubjectArrow.setOnClickListener(this);
    mView_SubjectName.setOnClickListener(this);
    addDayLesson.setOnClickListener(this);
    editWeekLesson.setOnClickListener(this);
    setUpInfo();
}
 
開發者ID:nhocga1995s,項目名稱:MyCalendar,代碼行數:41,代碼來源:WeekLessonDetailActivity.java

示例9: setNavigationMenu

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void setNavigationMenu(@MenuRes int menuRes, OnClickListener onClickListener) {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.nav_items_recycler);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
    menuNavigationItemsAdapter = new MenuNavigationItemsAdapter(getContext(), menuRes, onClickListener,
            foregroundColour);
    recyclerView.setAdapter(menuNavigationItemsAdapter);
}
 
開發者ID:byvlstr,項目名稱:fluentAppBar,代碼行數:9,代碼來源:FluentAppBar.java

示例10: createHeadView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void createHeadView() {

    View headView = LayoutInflater.from(getActivity())
        .inflate(R.layout.layout_attention_head_view, mRecyclerView, false);
    RecyclerView mBangumiRecycler = (RecyclerView) headView.findViewById(R.id.focus_head_recycler);
    mBangumiRecycler.setHasFixedSize(false);
    mBangumiRecycler.setNestedScrollingEnabled(false);
    mBangumiRecycler.setLayoutManager(new GridLayoutManager(getActivity(), 3));
    mBangumiRecycler.setAdapter(new AttentionBangumiAdapter(mBangumiRecycler, chaseBangumis));
    mHeaderViewRecyclerAdapter.addHeaderView(headView);
  }
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:12,代碼來源:HomeAttentionFragment.java

示例11: onCreateView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_unconfirmed_trips, container, false);

    // Set the adapter
    Context context = view.getContext();
    recyclerView = (RecyclerView) view.findViewById(R.id.list);
    if (mColumnCount <= 1) {
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
    } else {
        recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
    }
    recyclerView.addItemDecoration(new SimpleDividerItemDecoration(context));

    // fix scroll fling. less than ideal, but apparently there's still no other solution
    recyclerView.setNestedScrollingEnabled(false);

    IntentFilter filter = new IntentFilter();
    filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
    filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
    filter.addAction(MainService.ACTION_TRIP_REALM_UPDATED);
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(context);
    bm.registerReceiver(mBroadcastReceiver, filter);

    return view;
}
 
開發者ID:gbl08ma,項目名稱:underlx,代碼行數:28,代碼來源:UnconfirmedTripsFragment.java

示例12: onCreateView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    setUpActivity(getString(R.string.frag_disturbances_title), R.id.nav_disturbances, false, true);
    setHasOptionsMenu(true);

    View view = inflater.inflate(R.layout.fragment_disturbance_list, container, false);

    // Set the adapter
    Context context = view.getContext();
    emptyView = (TextView) view.findViewById(R.id.no_disturbances_view);
    recyclerView = (RecyclerView) view.findViewById(R.id.list);
    if (mColumnCount <= 1) {
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
    } else {
        recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
    }

    // fix scroll fling. less than ideal, but apparently there's still no other solution
    recyclerView.setNestedScrollingEnabled(false);

    getSwipeRefreshLayout().setRefreshing(true);

    IntentFilter filter = new IntentFilter();
    filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
    filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(context);
    bm.registerReceiver(mBroadcastReceiver, filter);

    new DisturbanceFragment.UpdateDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

    getSwipeRefreshLayout().setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            new DisturbanceFragment.UpdateDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        }
    });
    return view;
}
 
開發者ID:gbl08ma,項目名稱:underlx,代碼行數:40,代碼來源:DisturbanceFragment.java

示例13: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_collection);

    toolbar = (Toolbar) findViewById(R.id.toolbar1);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("Collections");
    toolbar.setTitleTextColor(ContextCompat.getColor(context, R.color.white));

    user_id = getIntent().getStringExtra(Constant.USER_ID);

    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    allList = new ArrayList<>();
    allAdapter = new CollectionAdapter(context, allList);
    allAdapter.setClickListener(new CollectionAdapter.ClickListener() {
        @Override
        public void onItemClickListener(View v, int pos) {
            CollectionItem item = allList.get(pos);
            startActivity(CollectionDetailActivity.getCallIntent(context, item));
        }
    });

    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setAdapter(allAdapter);

    getAllCollections();

}
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:32,代碼來源:UserCollectionActivity.java

示例14: setOptimalConfigurationForRecyclerView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
 * Procedure meant to apply the optimal configuration on a target {@link RecyclerView} instance.
 * @param recyclerView a target {@link RecyclerView} instance.
 */
public static void setOptimalConfigurationForRecyclerView(@NonNull final RecyclerView recyclerView) {
    recyclerView.setItemViewCacheSize(30);
    recyclerView.setDrawingCacheEnabled(true);
    recyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
    recyclerView.setHasFixedSize(true);
    recyclerView.setNestedScrollingEnabled(true);
}
 
開發者ID:Simdea,項目名稱:gmlrva,代碼行數:12,代碼來源:GenericUtils.java

示例15: onCreateView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    setUpActivity(getString(R.string.frag_announcements_title), R.id.nav_announcements, false, true);
    setHasOptionsMenu(true);

    View view = inflater.inflate(R.layout.fragment_announcement_list, container, false);

    // Set the adapter
    Context context = view.getContext();
    emptyView = (TextView) view.findViewById(R.id.no_announcements_view);
    recyclerView = (RecyclerView) view.findViewById(R.id.list);
    if (mColumnCount <= 1) {
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
    } else {
        recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
    }

    // fix scroll fling. less than ideal, but apparently there's still no other solution
    recyclerView.setNestedScrollingEnabled(false);

    getSwipeRefreshLayout().setRefreshing(true);

    new AnnouncementFragment.UpdateDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

    getSwipeRefreshLayout().setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            new AnnouncementFragment.UpdateDataTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        }
    });
    return view;
}
 
開發者ID:gbl08ma,項目名稱:underlx,代碼行數:34,代碼來源:AnnouncementFragment.java


注:本文中的android.support.v7.widget.RecyclerView.setNestedScrollingEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。