私のxmlデザインに問題があります。私は自分のアプリケーションにViewpagerを加え、ツールバーをアプリケーションの上に追加しました。ですから、私の問題は、私のViewpagerに属するフラグメントから重力中心のアイテムを中心にしようとすると、Viewpagerの中央に設定され、Toolbarの高さは無視されます。親ビューで画面全体を塗りつぶしていない場合のフラグメントの中心項目
私は親ビューが画面全体を満たしていないときに、画面の中央にあるビューまたはフラグメントからアイテムをセンターすることが可能かどうかを尋ねたいと思います。
私の活動のXMLはこの1つである:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar"
android:id="@+id/toolbar"></include>
<com.example.android.ui.SlidingTabLayout
android:id="@+id/module_selector_tabs"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@color/view_pager_top"
android:layout_below="@id/toolbar"
android:elevation="4dp"/>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/viewPager"
android:layout_below="@id/module_selector_tabs"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
私がセンターにしたい項目は、私がFragmentAdapterでViewpagerにdinamically追加フラグメントの内側にあります。誰かがこれを行う方法を知っていることを願っています!
敬具:私はちょうどタイマーテキスト& CircleProgressBarが、今、彼らはviewpagerの中老に合わせている全画面の中央にしたい、のような
今私のアプリが見えます!
あなたが望むスクリーンショットを投稿できますか? –
写真が追加され、もう少し定義が追加されました –