<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          BGABannerAndroid Splash 和圖片輪播控件

          聯(lián)合創(chuàng)作 · 2023-09-24 08:21

          BGABanner 包含Splash界面滑動導(dǎo)航和各種切換動畫自動輪播效果

          效果圖:

          基本使用

          1.添加Gradle依賴

          dependencies {
              compile 'com.nineoldandroids:library:2.4.0'
              compile 'com.android.support:support-v4:latestVersion'
              compile 'cn.bingoogolapple:bga-banner:latestVersion@aar'
              }

          2.在布局文件中添加BGABanner

          <cn.bingoogolapple.bgabanner.BGABanner 
              xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
              android:id="@+id/banner_splash_pager"
              style="@style/MatchMatch"
              app:banner_pointAutoPlayAble="false"
              app:banner_pointTopBottomMargin="15dp"/>

          3.在Activity或者Fragment中配置BGABanner

          public class SplashActivity extends AppCompatActivity {
          
              @Override
              protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_splash);
                  BGABanner banner = (BGABanner)findViewById(R.id.banner_splash_pager);
                  // 用Java代碼方式設(shè)置切換動畫
                  banner.setTransitionEffect(BGABanner.TransitionEffect.Rotate);
                  // banner.setPageTransformer(new RotatePageTransformer());
                  // 設(shè)置page切換時長
                  banner.setPageChangeDuration(1000);
                  List<View> views = new ArrayList<>();
                  views.add(getPageView(R.drawable.guide_1));
                  views.add(getPageView(R.drawable.guide_2));
                  views.add(getPageView(R.drawable.guide_3));
          
                  View lastView = getLayoutInflater().inflate(R.layout.view_last, null);
                  views.add(lastView);
                  lastView.findViewById(R.id.btn_last_main).setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          startActivity(new Intent(SplashActivity.this, MainActivity.class));
                          finish();
                      }
                  });
                  banner.setViews(views);
                  // banner.setCurrentItem(1);
              }
          
              private View getPageView(@DrawableRes int resid) {
                  ImageView imageView = new ImageView(this);
                  imageView.setImageResource(resid);
                  imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                  return imageView;
              }
          }

          自定義屬性說明

          <declare-styleable name="BGABanner">
              <!-- 指示點容器背景 -->
              <attr name="banner_pointContainerBackground" format="reference|color" />
              <!-- 指示點的背景 -->
              <attr name="banner_pointDrawable" format="reference" />
              <!-- 指示點容器左右內(nèi)間距 -->
              <attr name="banner_pointContainerLeftRightPadding" format="dimension" />
              <!-- 指示點上下外間距 -->
              <attr name="banner_pointTopBottomMargin" format="dimension" />
              <!-- 指示點左右外間距 -->
              <attr name="banner_pointLeftRightMargin" format="dimension" />
              <!-- 指示點的位置 -->
              <attr name="banner_pointGravity">
                  <flag name="top" value="0x30" />
                  <flag name="bottom" value="0x50" />
                  <flag name="left" value="0x03" />
                  <flag name="right" value="0x05" />
                  <flag name="center_horizontal" value="0x01" />
              </attr>
              <!-- 是否開啟自動輪播 -->
              <attr name="banner_pointAutoPlayAble" format="boolean" />
              <!-- 自動輪播的時間間隔 -->
              <attr name="banner_pointAutoPlayInterval" format="integer" />
              <!-- 頁碼切換過程的時間長度 -->
              <attr name="banner_pageChangeDuration" format="integer" />
              <!-- 頁面切換的動畫效果 -->
              <attr name="banner_transitionEffect" format="enum">
                  <enum name="defaultEffect" value="0" />
                  <enum name="alpha" value="1" />
                  <enum name="rotate" value="2" />
                  <enum name="cube" value="3" />
                  <enum name="flip" value="4" />
                  <enum name="accordion" value="5" />
                  <enum name="zoomFade" value="6" />
                  <enum name="fade" value="7" />
                  <enum name="zoomCenter" value="8" />
                  <enum name="zoomStack" value="9" />
                  <enum name="stack" value="10" />
                  <enum name="depth" value="11" />
                  <enum name="zoom" value="12" />
              </attr>
              <!-- 提示文案的文字顏色 -->
              <attr name="banner_tipTextColor" format="reference|color" />
              <!-- 提示文案的文字大小 -->
              <attr name="banner_tipTextSize" format="dimension" />
          </declare-styleable>
          瀏覽 26
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  日韩人妻高清 | 一道本一区二区三区在线视频 | 久久99精品蜜桃无码 | 国内自拍视频网站 | 人人操人人操人人操人人操人人操 |