0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android studio でScrollViewを使ったデータエントリー処理

Last updated at Posted at 2019-10-17

android studio開発でデータエントリー処理でHeader、Detail、Footer、の構成でDetail部分をScrollViewを利用しキーボードの表示時に入力中の項目に対して適時に画面をスクロールする様にする例です。


上記のような感じです使用出来ます。
1、Header部分をmergeタグを使って作成。

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:background="@drawable/white_grey_border_bottom"
    >

    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/profileToolBar">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">


            <ImageView
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginStart="10dp"
                android:layout_alignParentLeft="true"
                android:layout_marginEnd="20dp"
                android:layout_centerHorizontal="true"
                android:id="@+id/backArrow"
                android:src="@drawable/ic_backarrow"/>

            <TextView
                android:layout_toRightOf="@+id/backArrow"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:text="Edit Photo Detail"
                android:textSize="20sp"
                android:textColor="@color/black"
                android:layout_marginStart="5dp"
                android:id="@+id/profileName"/>

            <ImageView
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginStart="10dp"
                android:layout_alignParentRight="true"
                android:layout_marginEnd="20dp"
                android:layout_centerVertical="true"
                android:id="@+id/saveChanges"
                android:src="@drawable/ic_checkmark"/>


        </RelativeLayout>


    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

2、Footer部分も同じく作成。

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true">

    <com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/bottomNavViewBar"
        android:background="@drawable/white_grey_border_top"
        app:menu="@menu/menu_navigation">

    </com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx>


</RelativeLayout>

3、上記をmergeしたレイアウトを下記に。

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainLayout2"
>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/rellayout1">

        <include layout="@layout/snippet_top_editphototoolbar"/>

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/rellayout1"
        android:layout_alignParentBottom="true"
        android:id="@+id/rellayout2">


        <include layout="@layout/snippet_center_editphoto"/>


    </RelativeLayout>

    <!-- bottom navigation -->
    <include layout="@layout/layout_bottom_navigation_view"/>


</RelativeLayout>

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?