基本的に、私は水平スクロールビューを持っています。これは、ページングしているonTouchイベントを監視することによって(つまり、スクロール時に、スクロールビュー(ページ)の表示されている各部分が、標準のスクロールビューではなく、次の部分に「クリック」しますScrollView
。ページングされたスクロールビューを参照してください。 iOSの場合)。
ここで、インナーチャイルドにscrollview(に設定されている"fill_parent"
)と同じ幅を継承させる方法を見つけたいと思います。
これが私のXMLです。
<HorizontalScrollView
android:id="@+id/scrollview"
android:layout_height="0dp"
android:layout_width="fill_parent"
android:layout_weight="1"
android:background="@drawable/scrollviewbg">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ImageView
android:src="@drawable/content1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:src="@drawable/content2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:src="@drawable/content3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</HorizontalScrollView>
ご覧のとおり、スクロールビューは幅fill_parent
に設定されており、LinearLayout
その中にあります。現在、画面の幅と同じ幅と高さが設定された3つの画像がありますが、私がやりたいのは、それを3秒間変更することですLinearLayout
。
それぞれLinearLayout
がスクロールビューと同じ幅を継承する必要があるため、コードを適用すると、それぞれが「ページ」全体を占めるようになります。
どうすればいいですか?それは私がコードを使ってやらなければならないことですか?どのコードが必要ですか?
ありがとうございました。