<tfoot id='6ly22'></tfoot>
  1. <legend id='6ly22'><style id='6ly22'><dir id='6ly22'><q id='6ly22'></q></dir></style></legend>
    <i id='6ly22'><tr id='6ly22'><dt id='6ly22'><q id='6ly22'><span id='6ly22'><b id='6ly22'><form id='6ly22'><ins id='6ly22'></ins><ul id='6ly22'></ul><sub id='6ly22'></sub></form><legend id='6ly22'></legend><bdo id='6ly22'><pre id='6ly22'><center id='6ly22'></center></pre></bdo></b><th id='6ly22'></th></span></q></dt></tr></i><div id='6ly22'><tfoot id='6ly22'></tfoot><dl id='6ly22'><fieldset id='6ly22'></fieldset></dl></div>
      <bdo id='6ly22'></bdo><ul id='6ly22'></ul>

    <small id='6ly22'></small><noframes id='6ly22'>

      带有卡片堆栈的 Android 垂直视图寻呼机

      时间:2023-10-04

      <small id='CfLaf'></small><noframes id='CfLaf'>

          1. <legend id='CfLaf'><style id='CfLaf'><dir id='CfLaf'><q id='CfLaf'></q></dir></style></legend>
          2. <i id='CfLaf'><tr id='CfLaf'><dt id='CfLaf'><q id='CfLaf'><span id='CfLaf'><b id='CfLaf'><form id='CfLaf'><ins id='CfLaf'></ins><ul id='CfLaf'></ul><sub id='CfLaf'></sub></form><legend id='CfLaf'></legend><bdo id='CfLaf'><pre id='CfLaf'><center id='CfLaf'></center></pre></bdo></b><th id='CfLaf'></th></span></q></dt></tr></i><div id='CfLaf'><tfoot id='CfLaf'></tfoot><dl id='CfLaf'><fieldset id='CfLaf'></fieldset></dl></div>

              <tbody id='CfLaf'></tbody>
            <tfoot id='CfLaf'></tfoot>
              <bdo id='CfLaf'></bdo><ul id='CfLaf'></ul>
              • 本文介绍了带有卡片堆栈的 Android 垂直视图寻呼机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试实现一个垂直可滑动的 ViewPager 与外观类似的卡片堆栈.

                我可以使用 ViewPager.PageTransformer 并交换接触点来实现 VerticalViewPager.我正在关注卡片外观 -

                我想实现以下外观 -

                我怎样才能达到这个效果?提前致谢.

                解决方案

                为了实现这个垂直的View Pager 没有任何库依赖您可以按照以下步骤操作:

                1. 在您的 activity_main.xml

                2. 在您的 viewpager_contents.xml

                <块引用>

                您可以根据以上内容创建您想要的设计图片.

                1. 创建适配器模型类来保存数据.

                4.在MainActivity.java中,设置adapter和pageTransformer后添加如下代码.

                私有类 ViewPagerStack 实现 ViewPager.PageTransformer {@覆盖public void transformPage(查看页面,浮动位置) {如果(位置>= 0){page.setScaleX(0.7f - 0.05f * 位置);page.setScaleY(0.7f);page.setTranslationX(-page.getWidth() * 位置);page.setTranslationY(30 * 位置);}}}

                如需详细参考,您可以观看此视频:点击这里

                希望你能得到你需要的输出!!

                I am trying to implement a vertical swipeable ViewPager with stack of cards like appearance.

                I am able to achieve VerticalViewPager using ViewPager.PageTransformer and swapping the touch points. I am getting following card appearance -

                I want to achieve following appearance -

                How can I achieve this effect? Thanks in Advance.

                解决方案

                In order to achieve this vertical View Pager without any library dependency You can follow the steps below :

                1. In your activity_main.xml

                  <android.support.v4.view.ViewPager
                      android:layout_gravity="center"
                      android:layout_width="match_parent"
                      android:layout_height="600dp"
                      android:id="@+id/viewpager">
                  </android.support.v4.view.ViewPager>
                  

                2. In your viewpager_contents.xml

                You can create the design that you want according to the above picture.

                1. Create the adapter and model class to hold the data.

                4.In MainActivity.java, after setting the adapter and the pageTransformer add the following code.

                private class ViewPagerStack implements ViewPager.PageTransformer {
                    @Override
                    public void transformPage(View page, float position) {
                        if (position >= 0) {
                            page.setScaleX(0.7f - 0.05f * position);
                            page.setScaleY(0.7f);
                            page.setTranslationX(-page.getWidth() * position);
                            page.setTranslationY(30 * position);
                        }
                    }
                }
                

                For detailed reference you can watch this video: CLICK HERE

                Hope you will get the output what you needed!!

                这篇关于带有卡片堆栈的 Android 垂直视图寻呼机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  <tbody id='8gly7'></tbody>

                    <small id='8gly7'></small><noframes id='8gly7'>

                  • <tfoot id='8gly7'></tfoot>
                    <i id='8gly7'><tr id='8gly7'><dt id='8gly7'><q id='8gly7'><span id='8gly7'><b id='8gly7'><form id='8gly7'><ins id='8gly7'></ins><ul id='8gly7'></ul><sub id='8gly7'></sub></form><legend id='8gly7'></legend><bdo id='8gly7'><pre id='8gly7'><center id='8gly7'></center></pre></bdo></b><th id='8gly7'></th></span></q></dt></tr></i><div id='8gly7'><tfoot id='8gly7'></tfoot><dl id='8gly7'><fieldset id='8gly7'></fieldset></dl></div>
                      <bdo id='8gly7'></bdo><ul id='8gly7'></ul>
                    • <legend id='8gly7'><style id='8gly7'><dir id='8gly7'><q id='8gly7'></q></dir></style></legend>