本文整理匯總了Java中com.synnapps.carouselview.CarouselView類的典型用法代碼示例。如果您正苦於以下問題:Java CarouselView類的具體用法?Java CarouselView怎麽用?Java CarouselView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CarouselView類屬於com.synnapps.carouselview包,在下文中一共展示了CarouselView類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.synnapps.carouselview.CarouselView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample_carousel_view);
carouselView = (CarouselView) findViewById(R.id.carouselView);
customCarouselView = (CarouselView) findViewById(R.id.customCarouselView);
carouselLabel = (TextView) findViewById(R.id.carouselLabel);
customCarouselLabel = (TextView) findViewById(R.id.customCarouselLabel);
pauseButton = (Button) findViewById(R.id.pauseButton);
pauseButton.setOnClickListener(pauseOnClickListener);
carouselView.setPageCount(sampleImages.length);
customCarouselView.setPageCount(sampleImages.length);
customCarouselView.setSlideInterval(4000);
carouselView.setImageListener(imageListener);
customCarouselView.setViewListener(viewListener);
carouselView.setImageClickListener(new ImageClickListener() {
@Override
public void onClick(int position) {
Toast.makeText(SampleCarouselViewActivity.this, "Clicked item: "+ position, Toast.LENGTH_SHORT).show();
}
});
}
示例2: onCreateView
import com.synnapps.carouselview.CarouselView; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_home, container, false);
homeNewsRecyclerView = (RecyclerView) view.findViewById(R.id.home_news_recyclerView);
homeCalendarEventRecyclerView = (RecyclerView) view.findViewById(R.id.home_calendar_event_recyclerView);
mHomeCalendarPinnedRecyclerView = (RecyclerView) view.findViewById(R.id.home_calendar_pinned_recyclerView);
homeNewsRecyclerView.setNestedScrollingEnabled(false);
homeCalendarEventRecyclerView.setNestedScrollingEnabled(false);
mHomeCalendarPinnedRecyclerView.setNestedScrollingEnabled(false);
homeNewsRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
homeCalendarEventRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mHomeCalendarPinnedRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
homeNewsAdapter = new FlexibleAdapter<>(null);
homeCalendarEventAdapter = new EventAdapter(null);
homeCalendarPinnedAdapter = new EventAdapter(null);
homeNewsRecyclerView.setAdapter(homeNewsAdapter);
homeCalendarEventRecyclerView.setAdapter(homeCalendarEventAdapter);
mHomeCalendarPinnedRecyclerView.setAdapter(homeCalendarPinnedAdapter);
homeNewsRecyclerView.addItemDecoration(new DividerItemDecoration(getContext()));
homeCalendarEventRecyclerView.addItemDecoration(new DividerItemDecoration(getContext()));
mHomeCalendarPinnedRecyclerView.addItemDecoration(new DividerItemDecoration(getContext()));
carouselView = (CarouselView) view.findViewById(R.id.carouselView);
carouselView.setPageCount(8);
carouselView.setImageListener(imageListener);
int homeNewsAmount = PreferenceUtils.getHomeNewsAmount(getContext());
int homeEventsAmount = PreferenceUtils.getHomeEventsAmount(getContext());
int homePinnedAmount = PreferenceUtils.getHomePinnedAmount(getContext());
homeNewsHeader = (LinearLayout) view.findViewById(R.id.home_news_header_layout);
homeEventsHeader = (LinearLayout) view.findViewById(R.id.home_events_header_layout);
homePinnedHeader = (LinearLayout) view.findViewById(R.id.home_pinned_header_layout);
homeNoItemsView = (TextView) view.findViewById(R.id.home_no_items_shown_textview);
if (homeNewsAmount == 0)
homeNewsHeader.setVisibility(View.GONE);
if (homeEventsAmount == 0)
homeEventsHeader.setVisibility(View.GONE);
if (homePinnedAmount == 0)
homePinnedHeader.setVisibility(View.GONE);
if (homeNewsAmount == 0 && homeEventsAmount == 0 && homePinnedAmount == 0)
homeNoItemsView.setVisibility(View.VISIBLE);
newsSeeMoreTextView = (TextView) view.findViewById(R.id.recent_news_see_more_textview);
upcomingSeeMoreTextView = (TextView) view.findViewById(R.id.home_upcoming_events_see_more_textview);
pinnedSeeMoreTextView = (TextView) view.findViewById(R.id.home_pinned_events_see_more_textview);
navigationView = (NavigationView) view.findViewById(R.id.nav_view);
newsSeeMoreTextView.setOnClickListener(this);
upcomingSeeMoreTextView.setOnClickListener(this);
pinnedSeeMoreTextView.setOnClickListener(this);
return view;
}