xml
1<?xml version="1.0" encoding="utf-8"?> 2 3<android.support.design.widget.CoordinatorLayout 4 xmlns:android="http://schemas.android.com/apk/res/android" 5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:layout_width="match_parent" 7 android:layout_height="match_parent" 8 android:fitsSystemWindows="true"> 9 10 <android.support.design.widget.AppBarLayout 11 android:id="@+id/app_bar_layout" 12 android:layout_width="match_parent" 13 android:layout_height="wrap_content" 14 android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 15 android:fitsSystemWindows="true"> 16 17 <android.support.design.widget.CollapsingToolbarLayout 18 android:id="@+id/collapsing_toolbar" 19 android:layout_width="match_parent" 20 android:layout_height="match_parent" 21 app:layout_scrollFlags="scroll|exitUntilCollapsed" 22 app:contentScrim="?attr/colorPrimary" 23 app:expandedTitleMarginStart="0dp" 24 app:expandedTitleMarginEnd="0dp" 25 26 android:fitsSystemWindows="true"> 27 28 <android.support.v4.view.ViewPager 29 android:id="@+id/view_pager" 30 android:layout_width="match_parent" 31 android:layout_height="280dp" 32 android:adjustViewBounds="true" 33 /> 34 35 <android.support.v7.widget.Toolbar 36 android:id="@+id/toolbar" 37 android:layout_width="match_parent" 38 android:layout_height="?attr/actionBarSize" 39 app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 40 app:layout_collapseMode="pin" /> 41 42 </android.support.design.widget.CollapsingToolbarLayout> 43 44 </android.support.design.widget.AppBarLayout> 45 46 <android.support.v4.widget.NestedScrollView 47 android:id="@+id/scroll" 48 android:layout_width="match_parent" 49 android:layout_height="match_parent" 50 android:clipToPadding="false" 51 app:layout_behavior="@string/appbar_scrolling_view_behavior"> 52 53 54 <android.support.v7.widget.CardView 55 android:layout_width="match_parent" 56 android:layout_height="wrap_content" 57 android:layout_marginTop="8dp" 58 android:layout_marginBottom="20dp" 59 app:cardElevation="6dp" 60 app:cardUseCompatPadding="true"> 61 62 <LinearLayout 63 android:layout_width="match_parent" 64 android:layout_height="wrap_content" 65 android:orientation="vertical"> 66 67 <TextView 68 android:id="@+id/title" 69 android:layout_width="match_parent" 70 android:layout_height="wrap_content" 71 android:layout_marginTop="20dp" 72 android:layout_marginLeft="30dp" 73 android:layout_marginRight="30dp" 74 android:text="test" 75 android:textStyle="bold" 76 android:letterSpacing="0.1" 77 android:textSize="18dp" /> 78 <TextView 79 android:autoLink="web|all" 80 android:layout_width="match_parent" 81 android:layout_height="wrap_content" 82 android:layout_marginTop="15dp" 83 android:layout_marginLeft="30dp" 84 android:layout_marginRight="30dp" 85 android:layout_marginBottom="30dp" 86 android:lineSpacingExtra="5dp" 87 android:id="@+id/notes" 88 /> 89 90 <TextView 91 android:autoLink="web|all" 92 android:layout_width="match_parent" 93 android:layout_height="wrap_content" 94 android:layout_marginTop="15dp" 95 android:layout_marginLeft="30dp" 96 android:layout_marginRight="30dp" 97 android:layout_marginBottom="30dp" 98 android:lineSpacingExtra="5dp" 99 android:id="@+id/url" 100 /> 101 102 </LinearLayout> 103 104 </android.support.v7.widget.CardView> 105 106 107 </android.support.v4.widget.NestedScrollView> 108 <android.support.design.widget.FloatingActionButton 109 android:id="@+id/fab" 110 app:layout_anchor="@id/app_bar_layout" 111 style="@style/fab" 112 app:theme="@style/ThemeOverlay.AppCompat.Light" 113 app:layout_anchorGravity="bottom|right|end" 114 /> 115 116</android.support.design.widget.CoordinatorLayout>
上記XMLのような形で作成しているのですが、
ViewPagerの縦サイズを280dpにすると横幅の大きい端末で崩れてしまうため、
立幅を端末によって調整できるようにしたいです。
なにか方法はありませんでしょうか。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。