Support
Quality
Security
License
Reuse
kandi has reviewed AndroidImageSlider and discovered the below as its top functions. This is intended to give you an instant insight into AndroidImageSlider implemented functionality, and help decide if they suit your requirements.
An amazing and convenient Android image slider.
Step 1
dependencies {
compile "com.android.support:support-v4:+"
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
}
Step 2
<!-- if you want to load images from the internet -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- if you want to load images from a file OR from the internet -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Step 3
<com.daimajia.slider.library.SliderLayout
android:id="@+id/slider"
android:layout_width="match_parent"
android:layout_height="200dp"
/>
How to customize Indicator styling with com.glide.slider.library.SliderLayout?
binding.sliderProductImage.setCustomIndicator(custom_indicator as PagerIndicator)
QUESTION
How to customize Indicator styling with com.glide.slider.library.SliderLayout?
Asked 2020-Jun-25 at 14:47I have the following Slider Layout using this slider:
<com.glide.slider.library.SliderLayout
android:id="@+id/slider_product_image"
android:layout_width="500dp"
android:layout_height="350dp"/>
<com.glide.slider.library.indicators.PagerIndicator
android:id="@+id/custom_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
app:selected_height="20dp"
app:selected_width="20dp"/>
Here's the code I use to set it up:
//Slider
for (item in prod.images) {
val sliderView = DefaultSliderView(context)
// initialize SliderLayout
sliderView
.image(item)
.setRequestOption(
RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.skipMemoryCache(true)
)
binding.sliderProductImage.addSlider(sliderView)
}
binding.sliderProductImage.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom)
binding.sliderProductImage.stopCyclingWhenTouch(false)
binding.sliderProductImage.stopAutoCycle()
The slider is based on this one using picasso as image loader. The original slider allows for thorough indicator customization as can be seen here. There are available properties such as app:selected_height
and app:selected_width
, which are supposed to set the height and width of the indicator of the selected item, but they don't have any effect on the layout itself. Here's an image of my result:
The selected indicator is still the same size. Am I missing something? Is there a way to apply these properly?
ANSWER
Answered 2020-Jun-25 at 14:47Found my error... All the way at the bottom it says you need to bind it with a SliderLayout instance for it to work:
binding.sliderProductImage.setCustomIndicator(custom_indicator as PagerIndicator)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Explore Related Topics
Save this library and start creating your kit