本文整理汇总了Java中com.daimajia.slider.library.SliderLayout类的典型用法代码示例。如果您正苦于以下问题:Java SliderLayout类的具体用法?Java SliderLayout怎么用?Java SliderLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SliderLayout类属于com.daimajia.slider.library包,在下文中一共展示了SliderLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: imageSlider
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
private void imageSlider(NewsModel result) {
int sliderCount = (result.getPosts().size()%2 == 0) ?
result.getPosts().size() / 2:
result.getPosts().size() / 3;
for (int i = 0; i < sliderCount; i++) {
slidingImages.put(result.getPosts().get(i).getTitle(), result.getPosts().get(i).getThumbnail());
}
for(String name : slidingImages.keySet()){
TextSliderView textSliderView = new TextSliderView(getContext());
textSliderView
.description(name)
.image(slidingImages.get(name))
.setScaleType(BaseSliderView.ScaleType.Fit);
textSliderView.bundle(new Bundle());
textSliderView.getBundle()
.putString("extra", name);
sliderMain.addSlider(textSliderView);
}
sliderMain.setPresetTransformer(SliderLayout.Transformer.Default);
sliderMain.setPresetIndicator(SliderLayout.PresetIndicators.Center_Top);
sliderMain.setCustomAnimation(new DescriptionAnimation());
sliderMain.setDuration(4000);
}
示例2: initUI
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
private void initUI(View view) {
dataContainer = view.findViewById(R.id.fragment_product_detail_scroll_view_child_container);
productImagesViewPager = (SliderLayout) view.findViewById(R.id.fragment_product_detail_images_view_pager);
productImagesViewPagerMarkerContainer = (LinearLayout) view.findViewById(R.id.fragment_product_detail_product_images_view_pager_marker);
pbContainer = (RelativeLayout) view.findViewById(R.id.progress_bar_container);
addToCart = (FloatingActionButton) view.findViewById(R.id.add_to_cart);
back = (MaterialMenuView) view.findViewById(R.id.fragment_product_detail_tab_bar_back_img);
back.setState(MaterialMenuDrawable.IconState.ARROW);
share = (ImageView) view.findViewById(R.id.fragment_product_detail_tab_bar_share_img);
productName = (TextView) view.findViewById(R.id.fragment_product_detail_name_text_view);
price = (TextView) view.findViewById(R.id.fragment_product_detail_item_price);
ratingStars = view.findViewById(R.id.fragment_product_detail_rating_stars);
reviewContainer = view.findViewById(R.id.fragment_products_detail_view_review_container);
ratingCount = (TextView) view.findViewById(R.id.fragment_product_detail_rating_count);
reviewCount = (TextView) view.findViewById(R.id.fragment_product_detail_review_count);
productOptionsLinearLayout = (LinearLayout) view.findViewById(R.id.fragment_product_detail_layout_for_options);
productDescription = (TextView) view.findViewById(R.id.fragment_product_detail_description_value);
productSpecificationLinearLayout = (LinearLayout) view.findViewById(R.id.fragment_product_detail_layout_for_specification);
}
示例3: setupCurrentImagesViewPager
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
private void setupCurrentImagesViewPager(ArrayList<String> productImages) {
productImagesViewPager.removeAllSliders();
ViewGroup.LayoutParams vp = productImagesViewPager.getLayoutParams();
vp.height = (int) (DisplayArea.getDisplayWidth());
productImagesViewPager.setLayoutParams(vp);
for (String productImage : productImages) {
DefaultSliderView sliderView = new DefaultSliderView(home);
sliderView.image(productImage);
// sliderView.setOnSliderClickListener(new BaseSliderView.OnSliderClickListener() {
// @Override
// public void onSliderClick(BaseSliderView slider) {
// home.showProductsFragment(Constants.PRODUCTS_MODE_BANNER, null);
// }
// });
productImagesViewPager.addSlider(sliderView);
}
productImagesViewPager.setPresetTransformer(SliderLayout.Transformer.ZoomOutSlide);
productImagesViewPager.setIndicatorVisibility(PagerIndicator.IndicatorVisibility.Invisible);
productImagesViewPager.stopAutoCycle();
}
示例4: onOptionsItemSelected
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.action_custom_indicator:
mDemoSlider.setCustomIndicator((PagerIndicator) findViewById(R.id.custom_indicator));
break;
case R.id.action_custom_child_animation:
mDemoSlider.setCustomAnimation(new ChildAnimationExample());
break;
case R.id.action_restore_default:
mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
mDemoSlider.setCustomAnimation(new DescriptionAnimation());
break;
case R.id.action_github:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/daimajia/AndroidImageSlider"));
startActivity(browserIntent);
break;
}
return super.onOptionsItemSelected(item);
}
示例5: initListView
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
/**
* {@link ListView} initialize
*/
private void initListView() {
ListView listView = (ListView) findViewById(R.id.list_view);
View headerLayout = LayoutInflater.from(this)
.inflate(R.layout.layout_viewpager, null);
SliderLayout sliderLayout = (SliderLayout) headerLayout.findViewById(R.id.slider);
for (int resId : mPagerDatas) {
DefaultSliderView mSliderView = new DefaultSliderView(this);
mSliderView
.image(resId)
.setScaleType(BaseSliderView.ScaleType.Fit);
mSliderView.bundle(new Bundle());
mSliderView.getBundle().putInt("position", mPagerDatas.indexOf(resId));
sliderLayout.addSlider(mSliderView);
}
sliderLayout.setPresetTransformer(SliderLayout.Transformer.Default);
sliderLayout.setDuration(3000);
ListAdapter adapter = new ListAdapter(this, R.layout.list_item, mSampleDatas);
adapter.setViewPager(sliderLayout);
listView.setAdapter(adapter);
}
示例6: onCreateView
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View v = inflater.inflate(R.layout.fragment_image_slider, container,
false);
mDemoSlider = (SliderLayout) v.findViewById(R.id.image_slider);
mDemoSliderIndicator = v.findViewById(R.id.image_slider_indicator);
mProgressView = v.findViewById(R.id.loading_bar);
mImagesEmptyView = (TextView) v.findViewById(R.id.text_slider_empty);
mImagesTitleView = (TextView) v.findViewById(R.id.drone_image_slider_title);
Bundle bundle = getArguments();
mInterventionId = bundle.getLong("interventionId");
mPosition = new LatLng(bundle.getDouble("latitude"), bundle.getDouble("longitude"));
mImagesTitleView.setText(getString(R.string.drone_image_slider_title));
mostRecentTimestamp = 0L;
return v;
}
示例7: loadAdData
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
@Override
public void loadAdData(NewsInfo newsBean) {
View view = LayoutInflater.from(mContext).inflate(R.layout.head_news_list, null);
mAdSlider = (SliderLayout) view.findViewById(R.id.slider_ads);
SliderHelper.initAdSlider(mContext, mAdSlider, newsBean);
mAdapter.addHeaderView(view);
}
示例8: onCreateView
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_project, container, false);
// Inflate the layout for this fragment
mDemoSlider = (SliderLayout) view.findViewById(R.id.slider);
simpleList = (GridView) view.findViewById(R.id.simpleGridView);
mHandler = new Handler(Looper.getMainLooper()); // udaan hurdanii shalgax davtalt
HashMap<String,String> url_maps = new HashMap<String, String>();
url_maps.put("Өсвөр үеийн эрүүл ирээдүйн төлөө", "https://www.colourbox.com/preview/1282705-colorful-child-hand-prints-on-white-background.jpg");
url_maps.put("Өсвөр үеийн эрүүл ирээдүйн төлөө", "https://image.freepik.com/free-vector/fantastic-background-of-children-playing-together_23-2147608068.jpg");
url_maps.put("Өсвөр үеийн эрүүл ирээдүйн төлөө", "https://ak2.picdn.net/shutterstock/videos/14967505/thumb/1.jpg");
for(String name : url_maps.keySet()){
TextSliderView textSliderView = new TextSliderView(getActivity());
// initialize a SliderLayout
textSliderView
.description(name)
.image(url_maps.get(name))
.setScaleType(BaseSliderView.ScaleType.Fit);
// .setOnSliderClickListener(getContext());
//add your extra information
textSliderView.bundle(new Bundle());
textSliderView.getBundle()
.putString("extra",name);
mDemoSlider.addSlider(textSliderView);
}
mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Accordion);
mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
mDemoSlider.setCustomAnimation(new DescriptionAnimation());
mDemoSlider.setDuration(4000);
simpleList.setNumColumns(2);
simpleList.setVisibility(View.VISIBLE);
getProject();
return view;
}
示例9: onCreateView
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_detail_product, container, false);
android_id = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.ANDROID_ID);
FirebaseApp.initializeApp(getActivity());
firebaseDatabase = FirebaseDatabase.getInstance();
databaseReference = firebaseDatabase.getReference("basket").child(android_id);
btnAddBasket = (FlatButton) view.findViewById(R.id.btnAddBasket);
btnAddBasket.setOnClickListener(this);
progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("Ürün Yükleniyor..");
progressDialog.show();
progressDialog.hide();
//OnSuucese kaydet
sliderLayout = (SliderLayout) view.findViewById(R.id.slider);
tvPrice = (TextView) view.findViewById(R.id.tvPrice);
etPiece = (EditText) view.findViewById(R.id.etPiece);
etPiece.addTextChangedListener(this);
imageList = new ArrayList<>();
productIdExstra = getArguments().getInt("id");
urlDetail+=productIdExstra;
Request request = new Request(getActivity(), urlDetail, com.android.volley.Request.Method.GET);
request.requestVolley(this);
return view;
}
示例10: onCreateView
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_product_detail, container, false);
android_id = Secure.getString(getActivity().getContentResolver(), Secure.ANDROID_ID);
FirebaseApp.initializeApp(getActivity());
firebaseDatabase = FirebaseDatabase.getInstance();
databaseReference = firebaseDatabase.getReference("basket").child(android_id);
btnAddBasket = (FlatButton) view.findViewById(R.id.btnAddBasket);
btnAddBasket.setOnClickListener(this);
progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("Ürün Yükleniyor..");
progressDialog.show();
sliderLayout = (SliderLayout) view.findViewById(R.id.slider);
tvPrice = (TextView) view.findViewById(R.id.tvPrice);
etPiece = (EditText) view.findViewById(R.id.etPiece);
etPiece.addTextChangedListener(this);
imageList = new ArrayList<>();
productIdExstra = getArguments().getInt("id");
url+=productIdExstra;
Request request = new Request(getActivity(), url, com.android.volley.Request.Method.GET);
request.requestVolley(this);
return view;
}
示例11: onCreateView
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.h_homeplay, container, false);
mDemoSlider = (SliderLayout) v.findViewById(R.id.slider);
tv = (TextView) v.findViewById(R.id.text11);
b1 = (Button) v.findViewById(R.id.button1);
b2 = (Button) v.findViewById(R.id.button2);
b3 = (Button) v.findViewById(R.id.button3);
cancelSlider = (FButton) v.findViewById(R.id.cancelSlider);
return v;
}
示例12: setupCurrentOffersViewPager
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
private void setupCurrentOffersViewPager(ArrayList<Banner> currentOfferBanners) {
ViewGroup.LayoutParams vp = currentOffersViewPager.getLayoutParams();
vp.height = (int) (DisplayArea.getDisplayWidth()/1.72);
currentOffersViewPager.setLayoutParams(vp);
for (Banner currentOffer : currentOfferBanners) {
DefaultSliderView sliderView = new DefaultSliderView(home);
sliderView.image(currentOffer.getImage());
sliderView.setOnSliderClickListener(new BaseSliderView.OnSliderClickListener() {
@Override
public void onSliderClick(BaseSliderView slider) {
home.showProductsFragment(ProductsFragment.PRODUCTS_MODE_BANNER, null);
}
});
currentOffersViewPager.addSlider(sliderView);
}
currentOffersViewPager.setPresetTransformer(SliderLayout.Transformer.ZoomOutSlide);
currentOffersViewPager.setIndicatorVisibility(PagerIndicator.IndicatorVisibility.Invisible);
currentOffersViewPager.stopAutoCycle();
}
示例13: getItem
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
@Override
public Object getItem(int position) {
return SliderLayout.Transformer.values()[position].toString();
}
示例14: HeaderVH
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
public HeaderVH(View headerView) {
super(headerView);
mSlHeader = (SliderLayout) headerView.findViewById(R.id.sl_header);
mPagerIndicator = (PagerIndicator) headerView.findViewById(R.id.pi_header);
mSlHeader.setCustomIndicator(mPagerIndicator);
}
示例15: setSlider
import com.daimajia.slider.library.SliderLayout; //导入依赖的package包/类
@BindingAdapter(value = {"indicator", "data", "sliderClick"}, requireAll = false)
public static void setSlider(SliderLayout sliderLayout, PagerIndicator indicator, String data,
BaseSliderView.OnSliderClickListener onSliderClickListener) {
DisplayMetrics displayMetrics = AppContext.getInstance().getResources().getDisplayMetrics();
float width = displayMetrics.widthPixels;
ViewGroup.LayoutParams lp = sliderLayout.getLayoutParams();
lp.height = (int) (166 * width / 375);
sliderLayout.setLayoutParams(lp);
sliderLayout.requestLayout();
//清空旧的
sliderLayout.removeAllSliders();
List<String> banners = new ArrayList<>();
banners.add("http://jewely-image.b0.upaiyun.com/images/2017-02-22/148773250858acff1c6b69f.jpg");
banners.add("http://jewely-image.b0.upaiyun.com/images/2017-02-22/148774660958ad363167649.jpg");
banners.add("http://jewely-image.b0.upaiyun.com/ueditor/2017-02-28/1488248833.jpg");
banners.add("https://static.darryring.com/ueditor/2017-03-28/1490687105.jpg");
for (String banner : banners) {
DefaultSliderView defaultSliderView = new DefaultSliderView(AppContext.getInstance());
defaultSliderView.image(banner).empty(R.drawable.bg_image_loading).error(R.drawable.bg_image_loading)
.setScaleType(BaseSliderView.ScaleType.CenterCrop).setOnSliderClickListener(onSliderClickListener);
defaultSliderView.bundle(new Bundle());
defaultSliderView.getBundle().putSerializable("extra", banner);
sliderLayout.addSlider(defaultSliderView);
}
indicator.setDefaultIndicatorColor(ContextCompat.getColor(AppContext.getInstance(), R.color.pagerIndicator_select_color),
ContextCompat.getColor(AppContext.getInstance(), R.color.pagerIndicator_unSelect_color));
sliderLayout.setCustomIndicator(indicator);
sliderLayout.setCustomAnimation(new DescriptionAnimation());
sliderLayout.setDuration(3 * 1000);
sliderLayout.setRecoverCycleDuration(200);
sliderLayout.startAutoCycle();
}