Android初心者です。
本質問に関して、半日以上調べましたがどうしてもわからなかったので質問させてください。
#####質問目的
#####質問内容
画像の赤枠部分(Switchコンポーネントが内包されているバー)について、どのようにレイアウトするか(どのようなレイアウトを使って実現されているか)知りたいです。
LinearLayoutを使って実現するのが良いのでしょうか?
#####やったこと
画面最上部のアプリバー(アクションバー)の表示は調べてできました。(赤枠の部分も調べましたがサンプル実装が見当たらなかったです)
XML
1<?xml version="1.0" encoding="utf-8"?> 2<RelativeLayout 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 tools:context=".HogeActivity"> 9 10 <android.support.design.widget.AppBarLayout 11 android:id="@+id/appbar" 12 android:layout_width="match_parent" 13 android:layout_height="wrap_content"> 14 15 <android.support.v7.widget.Toolbar 16 android:id="@+id/toolbar" 17 android:layout_width="match_parent" 18 android:layout_height="wrap_content" 19 android:background="?attr/colorPrimary" 20 android:minHeight="?attr/actionBarSize" 21 android:theme="@style/Toolbar" 22 app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 23 /> 24 </android.support.design.widget.AppBarLayout> 25 26 <LinearLayout 27 android:id="@+id/content_frame" 28 android:layout_width="match_parent" 29 android:layout_height="wrap_content" 30 android:layout_below="@id/appbar" 31 android:orientation="vertical"> 32 33 </LinearLayout> 34 35</RelativeLayout>
#####環境
Java1.8
AndroidStudio2.1.2
compileSdkVersion 25
minSdkVersion 21
targetSdkVersion 23
以上、よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。