AndroidImageSlider
AndroidImageSlider copied to clipboard
How to hide the Grey Background of The Description
Hi there, I had used this lib and it's working perfectly, but I have 1 issue when I try to hide the Grey Background of The Description, so how can I fix it. Thanks alot :)
I have a same problem :)
Solved this issue. I created custom SliderView:
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.daimajia.slider.library.R.id;
import com.daimajia.slider.library.R.layout;
import com.daimajia.slider.library.SliderTypes.BaseSliderView;
public class CustomSliderView extends BaseSliderView {
public CustomSliderView(Context context) {
super(context);
}
public View getView() {
View v = LayoutInflater.from(this.getContext()).inflate(layout.render_type_text, null);
ImageView target = (ImageView) v.findViewById(id.daimajia_slider_image);
LinearLayout frame = (LinearLayout) v.findViewById(id.description_layout);
frame.setBackgroundColor(Color.TRANSPARENT);
// if you need description
// description.setText(this.getDescription());
this.bindEventAndShow(v, target);
return v;
}
And then you can use it for for adding images instead of DefaultSliderView or BaseSliderView
Hope it helps someone
it works perfect! Thank u bro
How to use it ?
Just create a new java class and copy that code.
Then in your activity where u create the slider. On the bucle you have something like this:
for(String name : url_maps.keySet()){ TextSliderView textSliderView = new TextSliderView(getContext()); // initialize a SliderLayout textSliderView .image(url_maps.get(name)) .setScaleType(BaseSliderView.ScaleType.Fit); mDemoSlider.addSlider(textSliderView); }
Change the TextSliderView for the new class you create. So if u name the class "CustomSliderView" for example it will be:
CustomSliderView textSliderView = new CustomSliderView(getContext());
Sry about my inglish skills. Hope this helps!
It is not necessary to create a custom slider view. Just use the DefaultSliderView, instead of TextSliderView. The TextSliderView have the specific purpose of displaying image with text. The DefaultSliderView show only the image.
Thanks. It works :)
@andreyluiz yeah it works 👍
Easy Solution: Just replace TextSliderView with DefaultSliderView and then gray bottom bar will be hide :)
please make a color of transparent in values colors by thi code of line