Horizontall scrolling in gridview in android - android

I'm New in Android application developer and on the stackoverflow.
I've searched a lot on horizontally scrolling in gridview.
I want to show images in grid view as horizontall scrolling.
Please help me.

hey please check this links it's maybe helpful to you.
1) http://android-er.blogspot.in/2012/07/implement-gallery-like.html
2) Horizontal ListView like Google Catalogs
3) Android GridView draw dividers

try this in xml file:
<HorizontalScrollView
android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<GridView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/gridview"
android:scrollbars="horizontal"/>
</HorizontalScrollView>

Related

Horizontal Scrolling Fragment with Custom View

I have a small problem , or rather I do not know how. I combed through every corner of the Internet ( guides , tutorials etc ... )
In practice I have extended a class of VIEW and I customized the class with canvas etc ...
This view is included in a layout where there is also button, and this layout is set to a fragment and shown in an Activity (as usual ) .
I need to do the " scroll " horizontal in custom view to show all the graphics even hidden because the screen is small . You know tell me some solution or guide?
I hope I explained myself .
Let me know and thanks in advance
Greetings
Use HorizontalSCrollView with LinearLayout and add your elements.
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<!-- your elements-->
</LinearLayout>
</HorizontalScrollView>

how to have a horizontal gridview at the end of scrollview

I have a scrollview that contain details of an item in my android app, what I need is to add a horizontal list of similar items (each inflate from a layout) at the end of this view. can anybody tell me how to do this?
P.S: I've tried Recyclerview and gridview and a library form this link but all of them are not working inside the scrollview !!!
Take a look at recent-images Library. It provides horizontal gridview(one row). Just add this library dependency and put below code in bottom of your scrollView.
<com.jess.ui.TwoWayGridView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#E8E8E8"
android:id="#+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
app:columnWidth="70dp"
app:rowHeight="70dp"
app:numColumns="auto_fit"
app:numRows="auto_fit"
app:verticalSpacing="16dp"
app:horizontalSpacing="16dp"
app:gravity="center"/>

Customized Vertical Scroll View

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

Android Grid View Scroll Horizontally

I am doing a task which retrieves images from server and displays in GridView in the application. This Grid view is scrolling up and down. But i want to scroll this view left to right as the menu screen scrolls.
Is it possible with grid view? Or Is there any better way to do this? please help me in doing this.
thanks in advance.
This isn't easily possible with the stock Android GridView. Try using this library:
two-way-gridview
(I found this library in this other answer: Horizontal scrolling grid view)
Is there any better way to do this?
Yes, there is.
You can achieve this in 3 lines using a RecyclerView with a horizontal GridLayoutManager:
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rec1);
recyclerView.setLayoutManager(new GridLayoutManager(this, 2, GridLayoutManager.HORIZONTAL, false));
recyclerView.setAdapter(new CustomAdapter(arrayList));
The RecyclerView supports applications built with the SDK 7 or larger.
If you want to make it even easier, take a look at the HorizontalGridView class if you are working with an application that is built for the API 17 or larger.
Here's a link of an example of a simple RecyclerView Adapter.
Try with below layout
<HorizontalScrollView android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<GridView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="#+id/gridview" android:columnWidth="50dp" android:padding="10dp"
android:horizontalSpacing="8dp" android:verticalSpacing="12dp"
android:numColumns="3" android:scrollbars="horizontal"/>
</HorizontalScrollView>

Android scroller paging with page indicator

I am about finishing my first android app, and i have some questions to which i could not find an answer.
I would like to use a horizontal scroller in which to display several pictures. For that i need two things:
Paging enabled, so that the user can see the pictures one by one in the scroller.
Some kind of indicator to show me the index of the picture currently displayed.
If i manage to do the paging, i could probably display a text like 1/4 (2/4 and so on) if i had 4 pictures, but it is not very nice. I would like to have something more like the iPhone has with the gray/white dots. Is there anything like that, or would i have to implement it by adding content at runtime? (adding imageviews according to the number of the pictures and then changing images for them as the user scrolls to show progress)
Thank you.
Because I was already using ViewPager for the swiping UI, I used the excellent ViewPagerIndicator. It took about 5 minutes to integrate.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000">
<include android:id="#+id/titlebar_include" layout="#layout/titlebar"/>
<include layout="#layout/menu"/>
<android.support.v4.view.ViewPager
android:layout_width="fill_parent"
android:id="#+id/product_viewpager"
android:layout_height="0dp"
android:layout_weight="1"
/>
<com.viewpagerindicator.CirclePageIndicator
android:id="#+id/indicator"
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
/>
</LinearLayout>
I found the answer i was looking for: i used the Gallery widget and for the indicator dots i used ImageViews and wrote a couple of lines of code to update the selected image dot.
Here is the solution you can try: PageViews and PageIndicator by GreenDroid.
You can also have a look at sample market app: https://market.android.com/details?id=com.cyrilmottier.android.gdcatalog

Categories

Resources