HorizontalScrollView
を使用して画像ギャラリーの種類を作成しようとしています。 私はボタンを垂直にセンタリングしたいと思いますが、gravity
を私のボタンにcenter_vertical
と指定しても、常に上にくっつくので、機能させる方法はありません。事前にHorizontalScrollViewの中のAndroidのセンタリングボタン
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">
<LinearLayout
android:id="@+id/container_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<HorizontalScrollView
android:id="@+id/horizontal_scroll_view"
android:layout_width="match_parent"
android:layout_height="@dimen/cameraPlaceholderHeight">
<LinearLayout
android:id="@+id/horizontal_scroll_view_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/greyBackgroundColor"
android:gravity="start|center_vertical"
android:orientation="horizontal">
<Button
android:id="@+id/camera_button"
android:layout_width="@dimen/take_picture_size"
android:layout_height="@dimen/take_picture_size"
android:layout_gravity="center_vertical"
android:background="@drawable/take_picture_rounded_button"
android:gravity="center_vertical"
android:src="@drawable/syi_camera_active"/>
</LinearLayout>
</HorizontalScrollView>
ありがとう: はここに私のレイアウトです! HorizontalScrollView中にあなたのLinearLayoutで
あなたの線形レイアウトの高さをmatch_parentに設定してください –
ありがとう、私の悪い! – noloman