I need a vertical scrollview similar as present in below image.
But I have Got scrollview as present in below picture
My code is
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:scrollbarThumbVertical="#drawable/scroll_bar_thumb"
android:scrollbarTrackVertical="#drawable/scroll_bar_track">
My problem is scroll_bar_thumb goes inside the scroll_bar_track. Give some solutions.
Thanks in advance.
Try looking here
Custom scrollbar Android
and maybe there
https://github.com/rno/Android-ScrollBarPanel
Related
I have a Webview loading static html content in my app.
the problem is, when I click on a link or an embed content (tweet, youtube video), the webview is scrolling back to the top.
It looks like a JS problem as mentioned here
I tried to use a NestedScrollView or some tricks with params like
android:focusableInTouchMode="true"
in a LinearLayout parent but nothing works
here's my xml :
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="#+id/article_webview"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.v4.widget.NestedScrollView>
it will be in a recycler view.
My question is :
is there a way to prevent this behavior in the webview settings or xml ?
Thanks !
I've been having the same problem. My WebView was inside a RecyclerView too.
When I added android:descendantFocusability="blocksDescendants" on my RecyclerView, the problem does not happen for me anymore.
<androidx.recyclerview.widget.RecyclerView
android:descendantFocusability="blocksDescendants"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
I've been having the same problem. My WebView was inside a
LinearLayout.
When I added android:descendantFocusability="blocksDescendants" on my LinearLayout.
Issue was fixed with this changes.
Over the past few weeks I've been learning to use the RecyclerView. I need to implement a horizontal list, ie, that by turning the device in landscape mode like so:
I found the best solution for this (how to create the horizontal displacement of RecyclerView, here), but encountered another problem. The item RecyclerView was larger than the height of the device (in landscape, horizontal), so I need to create a vertical and horizontal displacement, simultaneously.
I looked at the Android Developer methods for the LayoutManager class, but my skills are not high enough to understand most of the methods. I also tried putting a RecyclerView vertically inside another RecyclerView horizontally with all the content, but I get error:
IllegalStateException: RecyclerView has no LayoutManager
To rememedy this I removed all <View ... /> elements from the XML file, but this does not give any results.
To clarify what I am asking: is it possible to have my layout scroll both horizontally and vertically, and if you could explain how I would appreciate it.
I was so angry about all the problems that had tended with the application that had not thought about the easiest solution.
In a RecyclerView consists of two XML files, the main one where the RecyclerView is declared and another with content.
The simplest solution was to introduce the RecyclerView within a ScrollView. So I can move all items at a time thanks to ScrollView vertically and horizontally I can move the items thanks to RecyclerView in landscape mode.
activity_main.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="#dimen/cardIn_margin_ext">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbarStyle="outsideInset"
android:scrollbars="horizontal" />
</ScrollView>
The accepted answer did'nt work for me. I had to use the HorizontalScrollView instead of simple ScrollView.
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="#dimen/cardIn_margin_ext">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbarStyle="outsideInset"
android:scrollbars="horizontal" />
</HorizontalScrollView >
I have a data set and I need to show them using ListView and TableLayout in same xml file.As both ListView and TableLayout are much longer,I decide to use scrollView. I knew that android scrollview can only have one child. So I Coded as follows.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="8">
<LinearLayout
android:id="#+id/showClaim_layout2"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/claimList"
android:layout_margin="5dp">
</ListView>
<TableLayout
android:id="#+id/showClaimTable"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFEBCD"
android:layout_margin="5dp"
android:shrinkColumns="0">
</TableLayout>
</LinearLayout>
</ScrollView>
When I run the program it's ok. I mean page is scrolling. But it doesn't work as I expected!I need to show all the list element and after end of the list, tableLayout must be show.If the screen size is not enough then we can scroll the page and see the data.
In here ListView does not show all elements of the List and TableLayout show all tableRaws inside ScrollView.
Can anyone tell me that where I got wrong or any other way to do my task easily.
Thanks.
As far as I know, you should never put a ListViewinside a ScrollView, since they implement their own scrolling behavior. Consider changing your design.
"I knew that android scrollview can only have one child." Correct but you forget that that one child should have a height of wrap_content.
Also #haint is correct ListView has its own Scrolling Behavior. Still try android:layout_height="wrap_content" for your LinearLayout
I think you can fix it by using the
layout_weight
set layout_weight for your ListView to 1 and for TableLayour set it to 0;
Be sure after changing set layot*:height to 0dp;
You can check below articles.
first-
second-
I want to make a layout like shown in images below. it's like googlemap and you can zoom in/out with multi finger touch, and also scrolling in four way. is there any library supporting this layout?
zoomed out image:
[http://i57.tinypic.com/2hoz6rl.png][1]
zoomed in and scrolled:
[http://i58.tinypic.com/zxnqqb.png][2]
.....
third pic in the comments
Use ScrollView element in your xml
<ScrollView
android:id="#+id/someId"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<HorizontalScrollView
android:id="#+id/horizontalSomeId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fillViewport="true" >
`enter code here`
</HorizontalScrollView>
</ScrollView>
Use TouchImageView.
Refers this link.
How can I get zoom functionality for images?
From here you can download TouchImageView class or Library.
https://github.com/MikeOrtiz/TouchImageView
https://github.com/MikeOrtiz/TouchImageView/blob/master/src/com/ortiz/touch/TouchImageView.java
If its works for you then give me a Check mark for correct answer.
I have a ListView inside of a ScrollView - but my issue is that I don't want the Listview to scroll, instead I want the listview to be fully expanded and just scroll the ScrollView up and down to see the items of the ListView. Can someone recoment a solution?
Here is my layout:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
>
<ListView
android:id="#+id/user_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#null"
android:visibility="gone" />
</ScrollView>
P.S. I know that this is bad practice but I need this thing anyway
set this property in your scrollview android:fillViewport="true" it will work
two scrolling views cannot be inside one another.
Follow the following link:
ListView inside ScrollView is not scrolling on Android
You can consider this. But the ListView's height must be hard coded and it does recycling which slightly deviates from your requirement. But ListView without recycling, as you mentioned, is not a good practice. So try to achieve the thing with recycling as described in the above link.