如何在Android中将圆形页面指示器置于前台

12

我有一个视图分页画廊和底部的圆形页面指示器。我想把页面指示器放在视图分页画廊的前面,并使其透明,就像 iPhone 图片画廊一样。你有任何想法怎么做吗?

enter image description here

解决方案:

这里是 XML 代码作为解决方案。感谢 @sanna。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000">


<android.support.v4.view.ViewPager
    android:id="@+id/gallery_view"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    />

<com.viewpagerindicator.CirclePageIndicator
    android:id="@+id/indicator"
    android:padding="10dip"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:layout_alignParentBottom="true"
    />
</RelativeLayout>

这里展示了我的图库的新外观。

在此输入图片描述


请问您能分享一下ImageView的代码吗? - kgandroid
@kgandroid ImageView位于ViewPager内部。它本身并没有什么特别之处,只是一个全屏的ImageView。 - osayilgan
1个回答

17

我会先使用RelativeLayout,让你的Pager覆盖整个视图,然后使用parentAlignBottom=true添加指示器视图。


1
谢谢你的回答。它运行得相当不错。你也可以看到我编辑后的解决方案。 - osayilgan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接