タブレット用プログラムの書き止め

android OS & iPadOS の記録。

Activity から Fragment にプログラムを移植?移動か? (ソース2)

2021-07-08 04:19:05 | Android studio 日記

 【fragment_fullscreen.xml】

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment_fullscreen"
    android:tag="fullscreen_fragment_tag"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/fullscreenBackgroundColor"
    android:theme="@style/ThemeOverlay.TestViewer2.FullscreenContainer"
    android:configChanges="orientation|screenSize">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:ignore="UselessParent">


        <ViewSwitcher
            android:id="@+id/viewSwither"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </LinearLayout>
</RelativeLayout>

 

 

 "layout/image1.xml" android:id="@+id/h_scr1"
 "layout/image2.xml" android:id="@+id/h_scr2"
 この id/h_scr を元にタッチイベントを吸い出しオーバーライドする。


【layout/image1.xml】

<?xml version="1.0" encoding="utf-8"?>
<com.packagename.testviewer2.MyScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/h_scr1"
        >

        <LinearLayout
            android:id="@+id/L_Layout1"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            tools:ignore="ScrollViewSize">

            <ImageView
                android:id="@+id/image_view1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="center"
                android:layout_centerInParent="true"
                tools:ignore="ContentDescription,ObsoleteLayoutParam" />

        </LinearLayout>
    </HorizontalScrollView>
</com.packagename.testviewer2.MyScrollView>

 


【layout/image2.xml】

<?xml version="1.0" encoding="utf-8"?>
<com.packagename.testviewer2.MyScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/h_scr2"
        >

        <LinearLayout
            android:id="@+id/L_Layout2"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            tools:ignore="ObsoleteLayoutParam">

            <ImageView
                android:id="@+id/image_view2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:ignore="ContentDescription" />

        </LinearLayout>
    </HorizontalScrollView>
</com.packagename.testviewer2.MyScrollView>

 

 

 

 調整は続く。