本文整理匯總了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());
}
示例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);
}
示例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);
}
示例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());
}
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}