CoordinatorLayoutでフローティングボタンの上にイメージボタンを1つ追加したいと思っています。
画面サイズが変わった時に、ImageButtonがずれてしまうので綺麗に縦一列並べる方法についてご教授願いたいです。
下記XMLです。
よろしくお願いします。
xml
1<?xml version="1.0" encoding="utf-8"?> 2<android.support.design.widget.CoordinatorLayout 3 xmlns:android="http://schemas.android.com/apk/res/android" 4 xmlns:app="http://schemas.android.com/apk/res-auto" 5 xmlns:tools="http://schemas.android.com/tools" 6 android:layout_width="match_parent" 7 android:layout_height="match_parent" 8 app:layout_behavior="@string/appbar_scrolling_view_behavior" 9 tools:context="com.micstarter.mountain_collector.activity.MountainActivity" 10 tools:showIn="@layout/activity_mountain"> 11 12 <!-- 地図フラグメント--> 13 <LinearLayout 14 android:layout_width="match_parent" 15 android:layout_height="match_parent" 16 android:orientation="vertical"> 17 18 <fragment 19 android:id="@+id/map" 20 android:layout_width="match_parent" 21 android:layout_height="0dp" 22 android:layout_weight="1" 23 android:name="com.google.android.gms.maps.MapFragment" 24 xmlns:android="http://schemas.android.com/apk/res/android"/> 25 26 <ScrollView 27 android:id="@+id/scroll_info" 28 android:layout_width="match_parent" 29 android:layout_height="0dp" 30 android:layout_weight="1" 31 android:background="@color/white" 32 android:elevation="8dp"> 33 34 <include layout="@layout/content_mountain_info"/> 35 36 </ScrollView> 37 38 </LinearLayout> 39 40 <ImageButton 41 android:id="@+id/yamatokogen" 42 android:layout_width="60dp" 43 android:layout_height="60dp" 44 android:scaleType="fitCenter" 45 android:layout_gravity="right|center" 46 android:layout_marginRight="@dimen/fab_margin" 47 android:layout_marginBottom="136dp" 48 android:background="@null" 49 android:src="@drawable/icon_yamatokogen"/> 50 51 <android.support.design.widget.FloatingActionButton 52 android:id="@+id/fab" 53 android:layout_width="wrap_content" 54 android:layout_height="wrap_content" 55 android:layout_margin="@dimen/fab_margin" 56 android:src="@drawable/ic_add_white_24dp" 57 app:layout_anchor="@id/scroll_info" 58 app:layout_anchorGravity="right|top"/> 59 60</android.support.design.widget.CoordinatorLayout>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/02 04:40