私はこの質問が至る所で尋ねられるのを見ました、しかし私はそれぞれの場合がそれ自身の解決策を持っていると思います。私が持っているのはこれです:
<HorizontalScrollView
android:id="@+id/MenuScroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="48dp"
android:orientation="horizontal"
android:layout_gravity="center"
android:padding="0dp" >
<Button
android:layout_width="150dp"
android:layout_height="fill_parent" />
<Button
android:layout_width="150dp"
android:layout_height="fill_parent" />
<Button
android:layout_width="150dp"
android:layout_height="fill_parent" />
<Button
android:layout_width="150dp"
android:layout_height="fill_parent" />
<Button
android:layout_width="150dp"
android:layout_height="fill_parent" />
</LinearLayout>
</HorizontalScrollView>
そして、私がふりをしているのは、のLinearLayout
中央に配置されていることHorizontalScrollView
です。中央に配置されていますが(halfbutton-button-halfbuttonが表示されます)、最初のボタンまでスクロールできません。左側に隠されているコンテンツが占めるスペースが右側に追加され、の後にスペースが追加されているように見えHorizontalScrollView
ます。
動的に実行する必要がある場合でも、解決策はありますか?