高效輪播圖

package cn.luxurygroup.mall.common.widget;

import android.content.Context;

import android.content.res.TypedArray;

import android.graphics.drawable.Drawable;

import android.graphics.drawable.GradientDrawable;

import android.graphics.drawable.LayerDrawable;

import android.os.Handler;

import android.os.Message;

import android.support.annotation.NonNull;

import android.support.v4.view.PagerAdapter;

import android.support.v4.view.ViewPager;

import android.util.AttributeSet;

import android.view.Gravity;

import android.view.MotionEvent;

import android.view.View;

import android.view.ViewGroup;

import android.view.animation.Interpolator;

import android.widget.ImageView;

import android.widget.LinearLayout;

import android.widget.RelativeLayout;

import android.widget.Scroller;


import cn.luxurygroup.mall.R;


import com.bumptech.glide.Glide;


import java.lang.reflect.Field;

import java.util.ArrayList;

import java.util.List;


public class BannerLayout extends RelativeLayout {


? ? private ViewPager pager;

? ? //指示器容器

? ? private LinearLayout indicatorContainer;


? ? private Drawable unSelectedDrawable;

? ? private Drawable selectedDrawable;


? ? private int WHAT_AUTO_PLAY = 1000;


? ? private boolean isAutoPlay = true;


? ? private int itemCount;


? ? private int selectedIndicatorColor = 0xffff0000;

? ? private int unSelectedIndicatorColor = 0x88888888;


? ? private Shape indicatorShape = Shape.oval;

? ? private int selectedIndicatorHeight = 6;

? ? private int selectedIndicatorWidth = 6;

? ? private int unSelectedIndicatorHeight = 6;

? ? private int unSelectedIndicatorWidth = 6;


? ? private Position indicatorPosition = Position.centerBottom;

? ? private int autoPlayDuration = 4000;

? ? private int scrollDuration = 900;


? ? private int indicatorSpace = 3;

? ? private int indicatorMargin = 10;


? ? private int defaultImage;


? ? private enum Shape {

? ? ? ? rect, oval

? ? }


? ? private enum Position {

? ? ? ? centerBottom,

? ? ? ? rightBottom,

? ? ? ? leftBottom,

? ? ? ? centerTop,

? ? ? ? rightTop,

? ? ? ? leftTop

? ? }


? ? private OnBannerItemClickListener onBannerItemClickListener;


? ? private Handler handler = new Handler(new Handler.Callback() {

? ? ? ? @Override

? ? ? ? public boolean handleMessage(Message msg) {

? ? ? ? ? ? if (msg.what == WHAT_AUTO_PLAY) {

? ? ? ? ? ? ? ? if (pager != null) {

? ? ? ? ? ? ? ? ? ? pager.setCurrentItem(pager.getCurrentItem() + 1, true);

? ? ? ? ? ? ? ? ? ? handler.sendEmptyMessageDelayed(WHAT_AUTO_PLAY, autoPlayDuration);

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? return false;

? ? ? ? }

? ? });


? ? public BannerLayout(Context context) {

? ? ? ? super(context);

? ? ? ? init(null, 0);

? ? }


? ? public BannerLayout(Context context, AttributeSet attrs) {

? ? ? ? super(context, attrs);

? ? ? ? init(attrs, 0);

? ? }


? ? public BannerLayout(Context context, AttributeSet attrs, int defStyleAttr) {

? ? ? ? super(context, attrs, defStyleAttr);

? ? ? ? init(attrs, defStyleAttr);

? ? }


? ? private void init(AttributeSet attrs, int defStyle) {


? ? ? ? TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable.BannerLayoutStyle, defStyle, 0);

? ? ? ? selectedIndicatorColor = array.getColor(R.styleable.BannerLayoutStyle_selectedIndicatorColor, selectedIndicatorColor);

? ? ? ? unSelectedIndicatorColor = array.getColor(R.styleable.BannerLayoutStyle_unSelectedIndicatorColor, unSelectedIndicatorColor);


? ? ? ? int shape = array.getInt(R.styleable.BannerLayoutStyle_indicatorShape, Shape.oval.ordinal());

? ? ? ? for (Shape shape1 : Shape.values()) {

? ? ? ? ? ? if (shape1.ordinal() == shape) {

? ? ? ? ? ? ? ? indicatorShape = shape1;

? ? ? ? ? ? ? ? break;

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? selectedIndicatorHeight = (int) array.getDimension(R.styleable.BannerLayoutStyle_selectedIndicatorHeight, selectedIndicatorHeight);

? ? ? ? selectedIndicatorWidth = (int) array.getDimension(R.styleable.BannerLayoutStyle_selectedIndicatorWidth, selectedIndicatorWidth);

? ? ? ? unSelectedIndicatorHeight = (int) array.getDimension(R.styleable.BannerLayoutStyle_unSelectedIndicatorHeight, unSelectedIndicatorHeight);

? ? ? ? unSelectedIndicatorWidth = (int) array.getDimension(R.styleable.BannerLayoutStyle_unSelectedIndicatorWidth, unSelectedIndicatorWidth);


? ? ? ? int position = array.getInt(R.styleable.BannerLayoutStyle_indicatorPosition, Position.centerBottom.ordinal());

? ? ? ? for (Position position1 : Position.values()) {

? ? ? ? ? ? if (position == position1.ordinal()) {

? ? ? ? ? ? ? ? indicatorPosition = position1;

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? indicatorSpace = (int) array.getDimension(R.styleable.BannerLayoutStyle_indicatorSpace, indicatorSpace);

? ? ? ? indicatorMargin = (int) array.getDimension(R.styleable.BannerLayoutStyle_indicatorMargin, indicatorMargin);

? ? ? ? autoPlayDuration = array.getInt(R.styleable.BannerLayoutStyle_autoPlayDuration, autoPlayDuration);

? ? ? ? scrollDuration = array.getInt(R.styleable.BannerLayoutStyle_scrollDuration, scrollDuration);

? ? ? ? isAutoPlay = array.getBoolean(R.styleable.BannerLayoutStyle_isAutoPlay, isAutoPlay);

? ? ? ? defaultImage = array.getResourceId(R.styleable.BannerLayoutStyle_defaultImage,defaultImage);

? ? ? ? array.recycle();


? ? ? ? //繪制未選中狀態圖形

? ? ? ? LayerDrawable unSelectedLayerDrawable;

? ? ? ? LayerDrawable selectedLayerDrawable;

? ? ? ? GradientDrawable unSelectedGradientDrawable;

? ? ? ? unSelectedGradientDrawable = new GradientDrawable();


? ? ? ? //繪制選中狀態圖形

? ? ? ? GradientDrawable selectedGradientDrawable;

? ? ? ? selectedGradientDrawable = new GradientDrawable();

? ? ? ? switch (indicatorShape) {

? ? ? ? ? ? case rect:

? ? ? ? ? ? ? ? unSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE);

? ? ? ? ? ? ? ? selectedGradientDrawable.setShape(GradientDrawable.RECTANGLE);

? ? ? ? ? ? ? ? break;

? ? ? ? ? ? case oval:

? ? ? ? ? ? ? ? unSelectedGradientDrawable.setShape(GradientDrawable.OVAL);

? ? ? ? ? ? ? ? selectedGradientDrawable.setShape(GradientDrawable.OVAL);

? ? ? ? ? ? ? ? break;

? ? ? ? }

? ? ? ? unSelectedGradientDrawable.setColor(unSelectedIndicatorColor);

? ? ? ? unSelectedGradientDrawable.setSize(unSelectedIndicatorWidth, unSelectedIndicatorHeight);

? ? ? ? unSelectedLayerDrawable = new LayerDrawable(new Drawable[]{unSelectedGradientDrawable});

? ? ? ? unSelectedDrawable = unSelectedLayerDrawable;


? ? ? ? selectedGradientDrawable.setColor(selectedIndicatorColor);

? ? ? ? selectedGradientDrawable.setSize(selectedIndicatorWidth, selectedIndicatorHeight);

? ? ? ? selectedLayerDrawable = new LayerDrawable(new Drawable[]{selectedGradientDrawable});

? ? ? ? selectedDrawable = selectedLayerDrawable;


? ? }


? ? //添加本地圖片路徑

? ? public void setViewRes(List<Integer> viewRes) {

? ? ? ? List<View> views = new ArrayList<>();

? ? ? ? itemCount = viewRes.size();

? ? ? ? //主要是解決當item為小于3個的時候滑動有問題,這里將其拼湊成3個以上

? ? ? ? if (itemCount < 1) {//當item個數0

? ? ? ? ? ? throw new IllegalStateException("item count not equal zero");

? ? ? ? } else if (itemCount < 2) {//當item個數為1

? ? ? ? ? ? views.add(getImageView(viewRes.get(0), 0));

? ? ? ? ? ? views.add(getImageView(viewRes.get(0), 0));

? ? ? ? ? ? views.add(getImageView(viewRes.get(0), 0));

? ? ? ? } else if (itemCount < 3) {//當item個數為2

? ? ? ? ? ? views.add(getImageView(viewRes.get(0), 0));

? ? ? ? ? ? views.add(getImageView(viewRes.get(1), 1));

? ? ? ? ? ? views.add(getImageView(viewRes.get(0), 0));

? ? ? ? ? ? views.add(getImageView(viewRes.get(1), 1));

? ? ? ? } else {

? ? ? ? ? ? for (int i = 0; i < viewRes.size(); i++) {

? ? ? ? ? ? ? ? views.add(getImageView(viewRes.get(i), i));

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? setViews(views);

? ? }


? ? @NonNull

? ? private ImageView getImageView(Integer res, final int position) {

? ? ? ? ImageView imageView = new ImageView(getContext());

? ? ? ? imageView.setOnClickListener(new OnClickListener() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onClick(View v) {

? ? ? ? ? ? ? ? if (onBannerItemClickListener != null) {

? ? ? ? ? ? ? ? ? ? onBannerItemClickListener.onItemClick(position);

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? });

? ? ? ? imageView.setScaleType(ImageView.ScaleType.FIT_XY);

? ? ? ? Glide.with(getContext()).load(res).into(imageView);

? ? ? ? return imageView;

? ? }


? ? //添加網絡圖片路徑

? ? public void setViewUrls(List<String> urls) {

? ? ? ? List<View> views = new ArrayList<>();

? ? ? ? itemCount = urls.size();

? ? ? ? //主要是解決當item為小于3個的時候滑動有問題,這里將其拼湊成3個以上

? ? ? ? if (itemCount < 1) {//當item個數0

? ? ? ? ? ? throw new IllegalStateException("item count not equal zero");

? ? ? ? } else if (itemCount < 2) { //當item個數為1

? ? ? ? ? ? views.add(getImageView(urls.get(0), 0));

? ? ? ? ? ? views.add(getImageView(urls.get(0), 0));

? ? ? ? ? ? views.add(getImageView(urls.get(0), 0));

? ? ? ? } else if (itemCount < 3) {//當item個數為2

? ? ? ? ? ? views.add(getImageView(urls.get(0), 0));

? ? ? ? ? ? views.add(getImageView(urls.get(1), 1));

? ? ? ? ? ? views.add(getImageView(urls.get(0), 0));

? ? ? ? ? ? views.add(getImageView(urls.get(1), 1));

? ? ? ? } else {

? ? ? ? ? ? for (int i = 0; i < urls.size(); i++) {

? ? ? ? ? ? ? ? views.add(getImageView(urls.get(i), i));

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? setViews(views);

? ? }


? ? @NonNull

? ? private ImageView getImageView(String url, final int position) {

? ? ? ? ImageView imageView = new ImageView(getContext());

? ? ? ? imageView.setScaleType(ImageView.ScaleType.FIT_XY);

? ? ? ? imageView.setOnClickListener(new OnClickListener() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onClick(View v) {

? ? ? ? ? ? ? ? if (onBannerItemClickListener != null) {

? ? ? ? ? ? ? ? ? ? onBannerItemClickListener.onItemClick(position);

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? });

? ? ? ? imageView.setScaleType(ImageView.ScaleType.FIT_XY);

? ? ? ? if (defaultImage != 0){

? ? ? ? ? ? Glide.with(getContext()).load(url).placeholder(defaultImage).into(imageView);

? ? ? ? }else {

? ? ? ? ? ? Glide.with(getContext()).load(url).into(imageView);

? ? ? ? }

? ? ? ? return imageView;

? ? }


? ? //添加任意View視圖

? ? private void setViews(final List<View> views) {

? ? ? ? //初始化pager

? ? ? ? pager = new ViewPager(getContext());

? ? ? ? //添加viewpager到SliderLayout

? ? ? ? addView(pager);

? ? ? ? setSliderTransformDuration(scrollDuration);

? ? ? ? //初始化indicatorContainer

? ? ? ? indicatorContainer = new LinearLayout(getContext());

? ? ? ? indicatorContainer.setGravity(Gravity.CENTER_VERTICAL);

? ? ? ? RelativeLayout.LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);


? ? ? ? switch (indicatorPosition) {

? ? ? ? ? ? case centerBottom:

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.CENTER_HORIZONTAL);

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

? ? ? ? ? ? ? ? break;

? ? ? ? ? ? case centerTop:

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.CENTER_HORIZONTAL);

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_TOP);

? ? ? ? ? ? ? ? break;

? ? ? ? ? ? case leftBottom:

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

? ? ? ? ? ? ? ? break;

? ? ? ? ? ? case leftTop:

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_TOP);

? ? ? ? ? ? ? ? break;

? ? ? ? ? ? case rightBottom:

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

? ? ? ? ? ? ? ? break;

? ? ? ? ? ? case rightTop:

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

? ? ? ? ? ? ? ? params.addRule(RelativeLayout.ALIGN_PARENT_TOP);

? ? ? ? ? ? ? ? break;

? ? ? ? }

? ? ? ? //設置margin

? ? ? ? params.setMargins(indicatorMargin, indicatorMargin, indicatorMargin, indicatorMargin);

? ? ? ? //添加指示器容器布局到SliderLayout

? ? ? ? addView(indicatorContainer, params);


? ? ? ? //初始化指示器,并添加到指示器容器布局

? ? ? ? for (int i = 0; i < itemCount; i++) {

? ? ? ? ? ? ImageView indicator = new ImageView(getContext());

? ? ? ? ? ? indicator.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

? ? ? ? ? ? indicator.setPadding(indicatorSpace, indicatorSpace, indicatorSpace, indicatorSpace);

? ? ? ? ? ? indicator.setImageDrawable(unSelectedDrawable);

? ? ? ? ? ? indicatorContainer.addView(indicator);

? ? ? ? }

? ? ? ? LoopPagerAdapter pagerAdapter = new LoopPagerAdapter(views);

? ? ? ? pager.setAdapter(pagerAdapter);

? ? ? ? //設置當前item到Integer.MAX_VALUE中間的一個值,看起來像無論是往前滑還是往后滑都是ok的

? ? ? ? //如果不設置,用戶往左邊滑動的時候已經劃不動了

? ? ? ? int targetItemPosition = Integer.MAX_VALUE / 2 - Integer.MAX_VALUE / 2 % itemCount;

? ? ? ? pager.setCurrentItem(targetItemPosition);

? ? ? ? switchIndicator(targetItemPosition % itemCount);

? ? ? ? pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onPageSelected(int position) {

? ? ? ? ? ? ? ? switchIndicator(position % itemCount);

? ? ? ? ? ? }

? ? ? ? });

? ? ? ? startAutoPlay();


? ? }


? ? public void setSliderTransformDuration(int duration) {

? ? ? ? try {

? ? ? ? ? ? Field mScroller = ViewPager.class.getDeclaredField("mScroller");

? ? ? ? ? ? mScroller.setAccessible(true);

? ? ? ? ? ? FixedSpeedScroller scroller = new FixedSpeedScroller(pager.getContext(), null, duration);

? ? ? ? ? ? mScroller.set(pager, scroller);

? ? ? ? } catch (Exception e) {

? ? ? ? ? ? e.printStackTrace();


? ? ? ? }

? ? }


? ? /**

? ? ?* 開始自動輪播

? ? ?*/

? ? public void startAutoPlay() {

? ? ? ? stopAutoPlay(); // 避免重復消息

? ? ? ? if (isAutoPlay) {

? ? ? ? ? ? handler.sendEmptyMessageDelayed(WHAT_AUTO_PLAY, autoPlayDuration);

? ? ? ? }

? ? }


? ? @Override

? ? protected void onWindowVisibilityChanged(int visibility) {

? ? ? ? super.onWindowVisibilityChanged(visibility);

? ? ? ? if (visibility == VISIBLE) {

? ? ? ? ? ? startAutoPlay();

? ? ? ? } else {

? ? ? ? ? ? stopAutoPlay();

? ? ? ? }

? ? }



? ? /**

? ? ?* 停止自動輪播

? ? ?*/

? ? public void stopAutoPlay() {

? ? ? ? if (isAutoPlay) {

? ? ? ? ? ? handler.removeMessages(WHAT_AUTO_PLAY);

? ? ? ? }

? ? }


? ? @Override

? ? public boolean dispatchTouchEvent(MotionEvent ev) {

? ? ? ? switch (ev.getAction()) {

? ? ? ? ? ? case MotionEvent.ACTION_DOWN:

? ? ? ? ? ? ? ? stopAutoPlay();

? ? ? ? ? ? ? ? break;

? ? ? ? ? ? case MotionEvent.ACTION_CANCEL:

? ? ? ? ? ? case MotionEvent.ACTION_UP:

? ? ? ? ? ? ? ? startAutoPlay();

? ? ? ? ? ? ? ? break;

? ? ? ? }

? ? ? ? return super.dispatchTouchEvent(ev);

? ? }


? ? /**

? ? ?* 切換指示器狀態

? ? ?*

? ? ?* @param currentPosition 當前位置

? ? ?*/

? ? private void switchIndicator(int currentPosition) {

? ? ? ? for (int i = 0; i < indicatorContainer.getChildCount(); i++) {

? ? ? ? ? ? ((ImageView) indicatorContainer.getChildAt(i)).setImageDrawable(i == currentPosition ? selectedDrawable : unSelectedDrawable);

? ? ? ? }

? ? }



? ? public void setOnBannerItemClickListener(OnBannerItemClickListener onBannerItemClickListener) {

? ? ? ? this.onBannerItemClickListener = onBannerItemClickListener;

? ? }


? ? public interface OnBannerItemClickListener {

? ? ? ? void onItemClick(int position);

? ? }


? ? public class LoopPagerAdapter extends PagerAdapter {

? ? ? ? private List<View> views;


? ? ? ? public LoopPagerAdapter(List<View> views) {

? ? ? ? ? ? this.views = views;

? ? ? ? }


? ? ? ? @Override

? ? ? ? public int getCount() {

? ? ? ? ? ? //Integer.MAX_VALUE = 2147483647

? ? ? ? ? ? return Integer.MAX_VALUE;

? ? ? ? }


? ? ? ? @Override

? ? ? ? public boolean isViewFromObject(View view, Object object) {

? ? ? ? ? ? return view == object;

? ? ? ? }


? ? ? ? @Override

? ? ? ? public Object instantiateItem(ViewGroup container, int position) {

? ? ? ? ? ? if (views.size() > 0) {

? ? ? ? ? ? ? ? //position % view.size()是指虛擬的position會在[0,view.size())之間循環

? ? ? ? ? ? ? ? View view = views.get(position % views.size());

? ? ? ? ? ? ? ? if (container.equals(view.getParent())) {

? ? ? ? ? ? ? ? ? ? container.removeView(view);

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? container.addView(view);

? ? ? ? ? ? ? ? return view;

? ? ? ? ? ? }

? ? ? ? ? ? return null;

? ? ? ? }


? ? ? ? @Override

? ? ? ? public void destroyItem(ViewGroup container, int position, Object object) {

? ? ? ? }

? ? }


? ? public class FixedSpeedScroller extends Scroller {


? ? ? ? private int mDuration = 1000;


? ? ? ? public FixedSpeedScroller(Context context) {

? ? ? ? ? ? super(context);

? ? ? ? }


? ? ? ? public FixedSpeedScroller(Context context, Interpolator interpolator) {

? ? ? ? ? ? super(context, interpolator);

? ? ? ? }


? ? ? ? public FixedSpeedScroller(Context context, Interpolator interpolator, int duration) {

? ? ? ? ? ? this(context, interpolator);

? ? ? ? ? ? mDuration = duration;

? ? ? ? }


? ? ? ? @Override

? ? ? ? public void startScroll(int startX, int startY, int dx, int dy, int duration) {

? ? ? ? ? ? // Ignore received duration, use fixed one instead

? ? ? ? ? ? super.startScroll(startX, startY, dx, dy, mDuration);

? ? ? ? }


? ? ? ? @Override

? ? ? ? public void startScroll(int startX, int startY, int dx, int dy) {

? ? ? ? ? ? // Ignore received duration, use fixed one instead

? ? ? ? ? ? super.startScroll(startX, startY, dx, dy, mDuration);

? ? ? ? }

? ? }

}

《attrs》

<!--輪播圖 -->

? ? <declare-styleable name="BannerLayoutStyle">

? ? ? ? <attr name="selectedIndicatorColor" format="color|reference" />

? ? ? ? <attr name="unSelectedIndicatorColor" format="color|reference" />

? ? ? ? <attr name="indicatorShape" format="enum">

? ? ? ? ? ? <enum name="rect" value="0" />

? ? ? ? ? ? <enum name="oval" value="1" />

? ? ? ? </attr>


? ? ? ? <attr name="selectedIndicatorHeight" format="dimension|reference" />

? ? ? ? <attr name="selectedIndicatorWidth" format="dimension|reference" />


? ? ? ? <attr name="unSelectedIndicatorHeight" format="dimension|reference" />

? ? ? ? <attr name="unSelectedIndicatorWidth" format="dimension|reference" />


? ? ? ? <attr name="indicatorPosition" format="enum">

? ? ? ? ? ? <enum name="centerBottom" value="0" />

? ? ? ? ? ? <enum name="rightBottom" value="1" />

? ? ? ? ? ? <enum name="leftBottom" value="2" />

? ? ? ? ? ? <enum name="centerTop" value="3" />

? ? ? ? ? ? <enum name="rightTop" value="4" />

? ? ? ? ? ? <enum name="leftTop" value="5" />

? ? ? ? </attr>


? ? ? ? <attr name="indicatorSpace" format="dimension|reference" />

? ? ? ? <attr name="indicatorMargin" format="dimension|reference" />

? ? ? ? <attr name="autoPlayDuration" format="integer|reference" />

? ? ? ? <attr name="scrollDuration" format="integer|reference" />

? ? ? ? <attr name="isAutoPlay" format="boolean"/>

? ? ? ? <attr name="defaultImage" format="integer|reference"/>

? ? </declare-styleable>

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 229,362評論 6 537
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 99,013評論 3 423
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事?!?“怎么了?”我有些...
    開封第一講書人閱讀 177,346評論 0 382
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,421評論 1 316
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 72,146評論 6 410
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 55,534評論 1 325
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,585評論 3 444
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,767評論 0 289
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,318評論 1 335
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 41,074評論 3 356
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,258評論 1 371
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,828評論 5 362
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,486評論 3 347
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 34,916評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,156評論 1 290
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 51,993評論 3 395
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,234評論 2 375

推薦閱讀更多精彩內容