Java 如何更改pageviwer指示器的位置?
Java 如何更改pageviwer指示器的位置?,java,android,Java,Android,这是我的布局,现在它显示在页面中央。viwer如何更改为“底部帮助我”,如果删除android:layout\u centerInParent=“true”行,它将显示在顶部,就像您保持的那样到您的圆圈指示器它将仅显示在相对位置的中心 您需要设置循环指示器android:layout\u alignParentBottom=“true”并将查看页面设置为android:layout\u over=“@+id/indicator\u default”您的指示器 尝试以下代码: <?x
这是我的布局,现在它显示在页面中央。viwer如何更改为“底部帮助我”,如果删除android:layout\u centerInParent=“true”行,它将显示在顶部,就像您保持的那样到您的
圆圈指示器
它将仅显示在相对位置的中心
您需要设置循环指示器android:layout\u alignParentBottom=“true”
并将查看页面设置为android:layout\u over=“@+id/indicator\u default”
您的指示器
尝试以下代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager_default"
android:repeatCount="infinite"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<me.relex.circleindicator.CircleIndicator
android:id="@+id/indicator_default"
android:layout_centerInParent="true"
android:layout_width="fill_parent"
android:layout_height="40dp"/>
</RelativeLayout>
在onCreateView()方法中:
有关更多详细信息,请使用以下链接:
它可以工作,但有一个问题,底部显示了一个白色框。@VAISAKHPVR因为您给指示器指定了40 dp的高度,而给指示器指定了40 dp的宽度作为填充\u父项我已经更改了它们,请使用新代码检查。哎呀,它的总样式已经更改了,请检查新旧屏幕@VAISAKHPVR我已经更改了圆形指示器的高度和宽度,并且添加了填充请使用更新的代码检查谢谢您的回答请检查此屏幕
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<android.support.v4.view.ViewPager
android:id="@+id/viewpager_default"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/indicator_default"
android:repeatCount="infinite" />
<me.relex.circleindicator.CircleIndicator
android:id="@+id/indicator_default"
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</LinearLayout>
//Set the pager with an adapter
ViewPager pager = (ViewPager)findViewById(R.id.pager);
pager.setAdapter(new TestAdapter(getSupportFragmentManager()));
//Bind the title indicator to the adapter
CircleIndicator circleIndicator= (CircleIndicator)findViewById(R.id.titles);
circleIndicator.setViewPager(pager);