ビューページャのlayout_width
(幅)をXMLファイルの別のページャ(または両方の開始位置と終了位置が等しいはずです)に等しく設定したいとします。ConstraintLayout - ビューページャの幅
次のコードを試しましたが、動作していないようです。ここで
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context="com.example.xxx.yyy.MainActivity">
<android.support.v4.view.ViewPager
android:id="@+id/vpTop"
android:layout_width="@+id/vpCenter" // Here trying to assign width equal to orange view
android:layout_height="40dp"
android:layout_marginBottom="20dp"
android:background="@android:color/holo_green_light"
app:layout_constraintBottom_toTopOf="@+id/vpCenter"
></android.support.v4.view.ViewPager>
<android.support.v4.view.ViewPager
android:id="@+id/vpCenter"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="@android:color/holo_orange_light"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.view.ViewPager
android:id="@+id/vpBottom"
android:layout_width="@+id/vpCenter" // Here trying to assign width equal to orange view
android:layout_height="40dp"
android:layout_marginTop="20dp"
android:background="@android:color/holo_green_light"
app:layout_constraintTop_toBottomOf="@+id/vpCenter"
></android.support.v4.view.ViewPager>
</android.support.constraint.ConstraintLayout>
はプレビューです:
私はオレンジビューページャに等しいグリーンビューページャ両方の幅をしたいです。 注:オレンジビューページャはlayout_width
= 200と固定されています。両方のグリーンビューページャに固定幅(200)を設定する必要はありませんが、オレンジビューの幅を両方のグリーンビューに割り当てる必要があります。
はどのようにそれを行うことができます。私はこのような何かをしたい
(開始と終了の整列は対等でなければなりませんか)?
ニース、働いています – Krunal
お手伝いします。良い一日を! –