How to make webview scroll inside scrollview - android-scrollview

There are several vertically scrollable webviews inside a scrollview.
I want to send a touch event back to the scroll view when the webview is finished scrolling, and send an event back to the webview when the next webview arrives at the end of the screen.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="500dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="2000dp">
<WebView
android:layout_width="match_parent"
android:layout_height="500dp"/>
<WebView
android:layout_width="match_parent"
android:layout_height="500dp"/>
<WebView
android:layout_width="match_parent"
android:layout_height="500dp"/>
<WebView
android:layout_width="match_parent"
android:layout_height="500dp"/>
</LinearLayout>
I have a webview like above code
Is it possible to pass a scroll event like this?

Related

Resize an stretched Vector in ImageView - Android Studio

I've been searching this for a while but didn't found nothing. How can I resize an Vector inside an ImageView?
I tried a lot of things but didn't work. The vector is shown stretched like that:
My code is:
<com.google.android.material.card.MaterialCardView
android:id="#+id/card_view"
android:layout_width="240dp"
android:layout_height="140dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/buton_add_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/ic_add_image"
android:contentDescription="#string/add_image" />
</com.google.android.material.card.MaterialCardView>

There is gap on the top of bottom navigation view androidx

So i'm developing android app using kotlin, when i build bottom navigation bar, there is something like glitch as you can see on images below. Anyone knows why there is gap on top of bottom navigation view? it cause icon on selected item being cut off.
Running App
Design
Source Code:
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.bottomappbar.BottomAppBar
android:id="#+id/bottomAppBar"
android:layout_width="match_parent"
android:layout_height="95dp"
android:layout_gravity="bottom"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetEnd="0dp"
app:fabCradleRoundedCornerRadius="45dp"
app:fabCradleMargin="15dp">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottomNavigationBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:menu="#menu/bottom_nav"
android:background="#android:color/transparent" />
</com.google.android.material.bottomappbar.BottomAppBar>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_baseline_add_24"
app:layout_anchor="#id/bottomAppBar" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

fitsSystemWindows effect gone for either one of two fragments with CoordinatorLayout

I have an activity (contains 4 fragments) with transparent status bar. Two of the four fragments have AppBarLayout to collapse the toolbar. In order to avoid the AppBarLayout was draw behind the transparent status bar, I have:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/first_coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:statusBarBackground="#color/blue"
>
and
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/second_coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:statusBarBackground="#color/yellow"
>
in the these two fragments. I added android:fitsSystemWindows="true" for both of the fragment.
However, only one of the two fragments work properly. One is draw BELOW the status bar while the other one is still draw BEHIND the status bar. Do you guys have any idea why only one works?
Thanks!

Android zoom and pan overlay UI according to ImageView(Touch) matrix

I'm trying to create an interface that has a map (image) with clickable elements like text or buttons as overlay. The map is an ImageViewTouch element (src: https://github.com/sephiroth74/ImageViewZoom) and has zooming and panning capabilities through touch.
My current layout is as follows:
<it.sephiroth.android.library.imagezoom.ImageViewTouch
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:clickable="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:shadowColor="#000"
android:text="This is some random text"
android:textSize="22sp" />
</RelativeLayout>
The question is, how can I 'lock' the position of the TextView (and other elements) to the location according to the map. So the TextView moves and resizes as the user zooms or pans the image.
I'm new to Android UI development so I don't know what direction to take, like iterating over all elements and moving/resizing them according to the image scale and scroll values or...

LinearLayout android orientation

Heading ##I have one simple question.
I'm doing UI for the app.
I'm using a linearLayout, and to apply padding for my content, I'm using second LinearLayout inside the first o
So i found an xml example, But I can't understand why it is using two difrents orientation in Linearlayout?
So in the main Linearlayout orientation is set to horizontal, but in second linearLayout (which is inside the first one) orientation is set to vertical. And for me it is nonsense, why you should use a Horizontal orientation in main Linearlayout, if all content (buttons and textview) should be displayed only verticaly.
Thank you!
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#color/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="30dip"
android:orientation="horizontal" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/main_title"
android:layout_gravity="center"
android:layout_marginBottom="25dip"
android:textSize="24.5sp"/>
<Button
Perhaps in linearLayout, the programmer wanted to have TextView and Button beside each other in a same line.

Resources