Is there a way to show activity from top, without making page to jerk on touch

54
September 03, 2019, at 10:20 AM

scroll starts from middle of activity, I tried to use FocusinTouchMode = true in rootview, it shows activity from top but on touching layout it jumps?

below is xml file

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/relativeParent" android:layout_height="match_parent" android:layout_width="match_parent">
    <com.XXX.myapplication.Functions.ObservableHorizontalScrollView android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent">
        <LinearLayout android:gravity="center_vertical" android:onClick="scrollMethod" android:id="@+id/relativeLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
            <android.support.v7.widget.Toolbar android:layout_width="match_parent" android:layout_height="95dp" />
            <TextView android:layout_gravity="center" android:textSize="21sp" android:id="@+id/title" android:paddingTop="16dp" android:paddingRight="16dp" android:paddingBottom="16dp" android:paddingLeft="16dp" android:lineSpacingMultiplier="0.8" android:textColor="@color/colorBlackPrimaryDark" android:fontFamily="@font/nunito_sb" android:text="Android" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            <TextView android:fontFamily="@font/nunito_r" android:paddingRight="16dp" android:paddingBottom="16dp" android:paddingLeft="16dp" android:textSize="15sp" android:id="@+id/text" android:textColor="@color/colorBlackPrimaryDark" android:paddingTop="16dp" android:textIsSelectable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/long_text" />
            <TextView android:paddingBottom="50dp" android:paddingLeft="16dp" android:paddingTop="16dp" android:textColor="@color/colorBlackPrimaryDark" android:fontFamily="@font/nunito_r" android:id="@+id/rateText" android:textSize="15sp" android:layout_below="@+id/text" android:text="Rate this Read" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            <RatingBar android:paddingTop="5dp" android:scaleY="0.8" android:scaleX="0.8" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/ImageRatingBar" android:layout_toRightOf="@+id/rateText" android:layout_below="@+id/text" android:id="@+id/simpleRatingBar" android:stepSize="1" android:numStars="5" />
        </LinearLayout>
    </com.XXX.myapplication.Functions.ObservableHorizontalScrollView>
    <RelativeLayout android:onClick="toolbarMethod" android:elevation="8dp" android:id="@+id/relative1" android:background="@color/colorWhite" android:layout_width="match_parent" android:layout_height="95dp">
        <RelativeLayout android:layout_marginTop="45dp" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent">
            <ImageView android:padding="10dp" android:layout_marginLeft="12dp" android:src="@drawable/BlackBack" android:id="@+id/imgView" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            <ImageView android:layout_marginRight="80dp" android:padding="10dp" android:layout_alignParentRight="true" android:src="@drawable/TextSettingBlack" android:id="@+id/textSizes" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            <ImageView android:layout_marginRight="40dp" android:padding="10dp" android:layout_alignParentRight="true" android:src="@drawable/GreenStrokeBookmark1" android:id="@+id/bookmarks" android:layout_width="wrap_content" android:layout_height="wrap_content" />
            <ImageView android:layout_marginRight="10dp" android:padding="10dp" android:layout_alignParentRight="true" android:src="@drawable/GreenMore" android:id="@+id/imgView1" android:layout_width="wrap_content" android:layout_height="wrap_content" />
        </RelativeLayout>
    </RelativeLayout>
    <RelativeLayout android:visibility="gone" android:layout_marginRight="-10dp" android:layout_below="@+id/relative1" android:layout_alignParentRight="true" android:elevation="5dp" android:id="@+id/relativeLayout" android:layout_width="280dp" android:layout_height="match_parent">
        <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent">
            <ImageView android:clickable="false" android:layout_marginLeft="50dp" android:background="@drawable/CurvedRect" android:elevation="45dp" android:layout_marginTop="15dp" android:id="@+id/rect" android:layout_width="195dp" android:layout_height="125dp" />
        </RelativeLayout>
        <RelativeLayout android:layout_marginTop="8dp" android:clickable="true" android:id="@+id/relativeLayout3" android:layout_width="230dp" android:layout_height="160dp" android:layout_marginLeft="35dp" android:background="@drawable/CurvedRect" />
        <RelativeLayout android:clickable="false" android:id="@+id/relativeLayout4" android:layout_width="196dp" android:layout_height="160dp" android:layout_marginTop="15dp" android:layout_marginLeft="51dp" android:layout_marginBottom="25dp">
            <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" android:clickable="false" android:id="@+id/card_view" android:layout_width="196dp" android:layout_height="148dp" app:cardElevation="0dp" app:cardBackgroundColor="@android:color/white" card_view:cardCornerRadius="0dp" />
        </RelativeLayout>
        <ImageView android:elevation="15dp" android:rotation="180" android:id="@+id/notch" android:layout_width="20dp" android:layout_height="9dp" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_marginRight="110dp" android:src="@drawable/WhiteNotch" />
        <LinearLayout android:id="@+id/linearLayout1" android:layout_width="196dp" android:layout_height="140dp" android:layout_marginTop="25dp" android:layout_marginLeft="51dp" android:layout_marginBottom="25dp" android:orientation="vertical">
            <LinearLayout android:layout_width="196dp" android:layout_height="wrap_content" android:orientation="horizontal">
                <ImageView android:id="@+id/b_decrease" android:src="@drawable/BrightnessIncreaseBlack" android:layout_width="95dp" android:layout_height="30dp" android:layout_weight="1" />
                <SeekBar android:layout_gravity="center_vertical" android:id="@+id/seekBar1" android:layout_width="196dp" android:layout_height="30dp" android:layout_weight="1" />
                <ImageView android:id="@+id/b_increase" android:src="@drawable/BrightnessDecreaseBlack" android:layout_width="95dp" android:layout_height="30dp" android:layout_weight="1" />
            </LinearLayout>
            <LinearLayout android:clickable="false" android:orientation="horizontal" android:layout_marginTop="15dp" android:layout_width="196dp" android:layout_height="wrap_content">
                <LinearLayout android:clickable="false" android:id="@+id/linear1" android:background="@drawable/GreenBorder" android:layout_width="80dp" android:layout_height="30dp" android:layout_marginLeft="15dp" android:layout_marginRight="5dp" android:orientation="horizontal" android:layout_weight="1">
                    <ImageView android:clickable="false" android:id="@+id/bminus" android:layout_gravity="center_vertical" android:layout_weight="1" android:src="@drawable/BlackFontDecrease" android:layout_width="50dp" android:layout_height="53dp" />
                </LinearLayout>
                <LinearLayout android:clickable="false" android:id="@+id/linear2" android:background="@drawable/GreenBorder" android:layout_width="80dp" android:layout_height="30dp" android:layout_marginLeft="5dp" android:layout_marginRight="15dp" android:orientation="horizontal" android:layout_weight="1">
                    <ImageView android:clickable="false" android:id="@+id/bplus" android:layout_gravity="center_vertical" android:layout_weight="1" android:src="@drawable/BlackFontIncrease" android:layout_width="50dp" android:layout_height="48dp" />
                </LinearLayout>
            </LinearLayout>
            <LinearLayout android:orientation="horizontal" android:layout_marginTop="15dp" android:layout_width="196dp" android:layout_height="30dp">
                <ImageView android:id="@+id/n_mode" android:layout_gravity="center_vertical" android:layout_weight="1" android:layout_marginLeft="55dp" android:src="@drawable/NightBlack" android:layout_width="50dp" android:layout_height="40dp" />
                <Switch android:layout_marginRight="50dp" android:id="@+id/switch1" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="30dp"/>
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
</RelativeLayout>

Is it possible to make it work smoothly without any jerks?

READ ALSO
Grant &ldquo;Write&rdquo; Permission on the Root of Firebase Database (ONLY) to ALL Authenticated Users

Grant “Write” Permission on the Root of Firebase Database (ONLY) to ALL Authenticated Users

I am building an android app in which I want to permit any user that is registered and authenticated to be able to create a node on the root of the databaseBut I want ONLY HIM to be able to write to the child (and sub_child) nodes he created

26
ViewPager2 (AndroidX) causing issues with Count down timer

ViewPager2 (AndroidX) causing issues with Count down timer

I am building pager Recyclerview where each page has a timerAfter some seconds i need to change the page based on timer value

53
Retrofit onRequest is not working with modal class android

Retrofit onRequest is not working with modal class android

I am trying to get a JSON response from the server and using it in my projectI am using retrofit for HTTP call and getting a response but unable to get it in modal class

40
I&#39;m trying to read the data from my firestore database and have it output to a nativescript listview object

I'm trying to read the data from my firestore database and have it output to a nativescript listview object

I'm trying to populate the following NativeScript ListView object with the relevant data from my firestore database

24