Horizontal list view for Android which allows variable items widths

Overview

Deprecated

This widget is now deprecated and it won't be updated anymore. Use RecyclerView instead

Horizontal Variable ListView

Horizontal ListView for Android. Based on the official ListView google code. The library includes also an ExpandableHListView, also based on the official ExpandableListView.
See the demo project for sample implementations

Usage (gradle)

Add this line to your dependency group:

compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'

Features

It supports almost all the features of the ListView widget. There are minor differences in the attributes supported like "hlv_dividerWidth" instead of the default "dividerHeight".

This is the styleable used for the HListView class:

    <declare-styleable name="HListView">
        <attr name="android:entries" />
        <attr name="android:divider" />
        <attr name="hlv_dividerWidth" format="dimension" />
        <attr name="hlv_headerDividersEnabled" format="boolean" />
        <attr name="hlv_footerDividersEnabled" format="boolean" />
        <attr name="hlv_overScrollHeader" format="reference|color" />
        <attr name="hlv_overScrollFooter" format="reference|color" />
        
        <!-- 
        When "wrap_content" is used as value of the layout_height property.
        Pass the position, inside the adapter, of the view being used to measure the view
        or '-1' to use the default behavior ( default is -1 )
        -->
        <attr name="hlv_measureWithChild" format="integer" />
    </declare-styleable>
    

    <declare-styleable name="AbsHListView">
        <attr name="android:listSelector" />
        <attr name="android:smoothScrollbar" />
        <attr name="android:drawSelectorOnTop" />
        <attr name="android:cacheColorHint" />
        <attr name="android:scrollingCache" />
        <attr name="android:choiceMode" />
        
        <attr name="hlv_stackFromRight" format="boolean" />
        <attr name="hlv_transcriptMode">
            <enum name="disabled" value="0"/>
            <enum name="normal" value="1" />
            <enum name="alwaysScroll" value="2" />
        </attr>
        
    </declare-styleable>  

ChangeLog

  • 1.2.0 Added the ExpandableHListView

API Requirements

The minimum supported Android version is android 2.3 (API Level 9)

License

This software is distributed under Apache License 2.0: http://www.apache.org/licenses/LICENSE-2.0


Author Alessandro Crugnola

Comments
  • 2 days lost trying to understand why item click doesn't work

    2 days lost trying to understand why item click doesn't work

    =(( why did you break compatibility

    AdapterView.setOnItemClickListener and HorizontalVariableListView.setOnItemClick>>ed<<Listener

    it's not trivial to find this little difference, please don't do this in the future.

    opened by veonua 26
  • OnItemClicked doesn't fire

    OnItemClicked doesn't fire

    Hey all,

    First of all, i want to thank you Alessandro for this lovely component. I have also tested the dev-smart's HorizontalListView, and i am getting much better results with your view.

    Unfortunately though, I am suffering from one main problem - while i can scroll nice and smooth, i can't catch onItemClicked events. I have followed the example you've provided in the demo activity. More frustrating is the fact that when i test the same views and layouts i am using, with android's native ListView, and dev-smart's HLV it actually works. I made sure i was using the correct classed, but still can't get it to work.

    Would appreciate if you guys could take a look at my code, and see whether i am doing something terribly catastrophic. After looking at it for the entire day, i am positive i am missing something very fundamental

    The element view:

    <ImageView 
        android:id="@+id/channel_slide_thumbnail_bg"
        android:layout_width="134dp"
        android:layout_height="134dp"
        android:clickable="false"
        android:background="@drawable/thumb_fpo_223x223" />
    
    <ImageView
        android:id="@+id/channel_slide_thumbnail_photo"
        android:layout_width="132dp"
        android:layout_height="132dp"
        android:layout_alignLeft="@+id/channel_slide_thumbnail_bg"
        android:layout_alignTop="@+id/channel_slide_thumbnail_bg"
        android:layout_marginLeft="1dp"
        android:layout_marginTop="1dp"
        android:adjustViewBounds="true" 
        android:scaleType="fitCenter"/>
    
    <ImageView
        android:id="@+id/channel_slide_thumbnail_header"
        android:layout_width="134dp"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/channel_slide_thumbnail_bg"
        android:layout_alignTop="@+id/channel_slide_thumbnail_bg"        
        android:background="@drawable/header_thumb_channel" />
    
    <TextView 
        android:id="@+id/channel_slide_thumbnail_channel_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/channel_slide_thumbnail_header"
        android:layout_alignLeft="@+id/channel_slide_thumbnail_header"
        android:layout_marginLeft="6dp"
        android:textSize="12sp"
        android:textColor="@color/white"/>
    
    <TextView 
        android:id="@+id/channel_slide_thumbnail_viewer_number"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/channel_slide_thumbnail_header"
        android:layout_alignRight="@+id/channel_slide_thumbnail_header"
        android:layout_marginRight="6dp"
        android:textSize="12sp"/>
    

    HVLV's container

    <RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content">       
    
        <ImageView 
            android:id="@+id/slide_menus_background"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/back_home" />
    
        <ImageView 
            android:id="@+id/slide_menus_recommended_subheader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/subheader_channels" />
    
        <TextView 
            android:id="@+id/slide_menus_recommended_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/slide_menus_recommended_subheader"
            android:layout_marginLeft="@dimen/slider_subheader_horizontal_margin"
            android:layout_marginBottom="@dimen/slider_subheader_vertical_margin"
            android:text="@string/recommended_label" />
    
        <it.sephiroth.android.library.widget.HorizontalVariableListView
            android:id="@+id/slide_menus_recommended_slider"
            android:layout_width="fill_parent"
            android:layout_height="134dp"
            android:layout_below="@+id/slide_menus_recommended_subheader" />
    
        <ImageView 
            android:id="@+id/slide_menus_talk_subheader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/slide_menus_recommended_slider"
            android:background="@drawable/subheader_channels" />
    
        <TextView 
            android:id="@+id/slide_menus_talk_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/slide_menus_talk_subheader"
            android:layout_marginLeft="@dimen/slider_subheader_horizontal_margin"
            android:layout_marginBottom="@dimen/slider_subheader_vertical_margin"
            android:text="@string/talk_label" />
    
        <it.sephiroth.android.library.widget.HorizontalVariableListView
            android:id="@+id/slide_menus_talk_slider"
            android:layout_width="fill_parent"
            android:layout_height="134dp"
            android:layout_below="@+id/slide_menus_talk_subheader" />
    
    </RelativeLayout>
    

    Element adapter

    public class ChannelSlideThumbnailsAdapter extends BaseAdapter {

    private Activity activity;
    private List<ChannelSlideData> channelsSlideData;
    private static LayoutInflater inflater=null;
    
    public ChannelSlideThumbnailsAdapter(Activity a, List<ChannelSlideData> channelsSlideData) {
        activity = a;
        this.channelsSlideData = channelsSlideData;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }
    
    public int getCount() {
        return channelsSlideData.size();
    }
    
    public Object getItem(int position) {
        return position;
    }
    
    public long getItemId(int position) {
        return position;
    }
    
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    
        View vi = convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.view_channelslidethumbnail, null);
    
        ImageView channelPhoto = (ImageView) vi.findViewById(R.id.channel_slide_thumbnail_photo);
        TextView channelName = (TextView)vi.findViewById(R.id.channel_slide_thumbnail_channel_name);
        TextView channelViewersNumber = (TextView)vi.findViewById(R.id.channel_slide_thumbnail_viewer_number);
    
        ChannelSlideData channelSlideData = channelsSlideData.get(position);
    
        // load image
        try {
            // get input stream
            InputStream ims = activity.getAssets().open(channelSlideData.avatarUrl);
            // load image as Drawable
            Drawable d = Drawable.createFromStream(ims, null);
            // set image to ImageView
            channelPhoto.setImageDrawable(d);            
        }
        catch(IOException ex) {
            // TODO - what should be done here?
        }
    
        channelName.setText(channelSlideData.channelName);
        channelViewersNumber.setText(Integer.toString(channelSlideData.viewersNo));
    
        return vi;
    }
    

    }


    View creation:

    mRecommendedSlide = (HorizontalVariableListView) getActivity().findViewById(R.id.slide_menus_recommended_slider);

        final List<ChannelSlideData> channelSlideThumbnailsData = new ArrayList<ChannelSlideData>();
        ChannelSlideData channelSlideData;
    
        for (int i=0; i < 10 ; i++) {
            channelSlideData = new ChannelSlideData();      
            channelSlideData.avatarUrl = "images/camel.png";
            channelSlideData.channelName = "Shows";
            channelSlideData.viewersNo = 1000;
            channelSlideThumbnailsData.add(channelSlideData);
        }
    
        ChannelSlideThumbnailsAdapter adapter = new ChannelSlideThumbnailsAdapter(getActivity(), channelSlideThumbnailsData);
        mRecommendedSlide.setOverScrollMode( HorizontalVariableListView.OVER_SCROLL_ALWAYS );
        mRecommendedSlide.setAdapter(adapter);
    
        // Click event for single list row
        mRecommendedSlide.setOnItemClickedListener( new OnItemClickedListener() {
    
            @Override
            public boolean onItemClick( AdapterView<?> parent, View view, int position, long id ) {
                Log.e( TAG_LOG, "onItemClick: " + position );
                return true;
            }
        });
    

    Would appreciate any help with this.

    Thanks, K

    opened by klommenz 7
  • ClassCastException occurs when App Package is different than the R.java package

    ClassCastException occurs when App Package is different than the R.java package

    The Android Gradle Plugin allows you to rename the App package, which is convenient for installing your debug and release apps on the same device.

    I've traced it down to this line: https://github.com/sephiroth74/HorizontalVariableListView/blob/master/library/src/it/sephiroth/android/library/widget/AbsHListView.java#L5794

    See https://groups.google.com/forum/?fromgroups=#!topic/adt-dev/cqdjG2TuM-I

    from Xavier Ducrohet:

    They make the assumption that the package name of the app is the same as the R class. This really is not correct. While the previous build system somewhat implied this, aapt always had the feature to generate the R class in a different package.

    Thinking about it there really is no current way to query the app for the package of the R class. It'd have to be provided to the library.

    opened by mbarany 5
  • Disapearing items, when scrolling HVLV

    Disapearing items, when scrolling HVLV

    What should I do to use HorizontalVariableListView with BaseAdapter. I have class:

    public class BrochuresHorizontalAdapter extends BaseAdapter{ private SparseArray items; ... } which stores list items in SparseArray. Unfortunately sometimes removed views by recycler are not recreated. getView is not invoked on low positions and items simply disappear. (--update: getView() is invoked)

    Is it because I need some special things to make it work as Listview?

    maybe question doesn't have sense, because BaseAdapter implements ListAdapter. But what could cause such behavior.

    opened by Malachiasz 5
  • Removed last Resources#getIdentifier calls.

    Removed last Resources#getIdentifier calls.

    Replaced the last Resources#getIdentifier calls with ordinary uses of R. This also fixes crashes due to missing resources when the APK package is renamed with aapt's --rename-manifest-package option.

    opened by hborders 4
  • Question: get scroll position in pixels.

    Question: get scroll position in pixels.

    Hello.

    Can I get current scroll offset in pixels for horisontal list? I want to save exact scroll state of list to restore it after user re-enter activity.

    Thanks in advance

    opened by nesterov-n 3
  • Maybe simplify this a bit?

    Maybe simplify this a bit?

    There was a request for a jar file to download earlier. The solution for that issue is frankly unsatisfactory. I think making this code open source is fantastic. Except that to use it in one's Android application, one must:

    1. Get and learn how to use gradle.
    2. Solve the bugs related to compiling this using gradle (I didn't btw, took too much effort).
    3. Strip out all your styles associated with this widget.
    4. Finally compile it into a jar.
    5. Wonder where the last 2 days of time went.

    Again, this is a sorely needed widget and I'm grateful that you've taken the time to convert ListView source over to a horizontal one. But as it is now, this is completely unusable in my opinion. I hope this spurs you to make what I'm sure would be a few minor changes to make this useful to the wide range of folks who are coming across it and (undoubtedly not using it).

    Thanks, Matt

    opened by mjacobsen 3
  • Problems with Proguard

    Problems with Proguard

    Hello,

    In my Project I use this HorizontalVariableListView (thanks a lot!) Using the HorizontalVariableListView with Proguard (in order to release my app) I have problems. Could you give me some tips what to do? Here is the proguard log.

    Proguard returned with error code 1. See console Warning: it.sephiroth.android.library.util.v16.ViewHelper16: can't find referenced method 'void postOnAnimation(java.lang.Runnable)' in class android.view.View Warning: it.sephiroth.android.library.widget.AbsHListView: can't find referenced method 'boolean performAccessibilityAction(int,android.os.Bundle)' in class it.sephiroth.android.library.widget.AdapterView Warning: it.sephiroth.android.library.widget.AbsHListView: can't find referenced method 'int getImportantForAccessibility()' in class android.view.View Warning: it.sephiroth.android.library.widget.AbsHListView: can't find referenced method 'void setImportantForAccessibility(int)' in class android.view.View Warning: it.sephiroth.android.library.widget.AbsHListView$RecycleBin: can't find referenced method 'boolean hasTransientState()' in class android.view.View Warning: it.sephiroth.android.library.widget.AdapterView: can't find referenced method 'int getImportantForAccessibility()' in class it.sephiroth.android.library.widget.AdapterView Warning: it.sephiroth.android.library.widget.AdapterView: can't find referenced method 'void setImportantForAccessibility(int)' in class it.sephiroth.android.library.widget.AdapterView Warning: it.sephiroth.android.library.widget.AdapterView: can't find referenced method 'int getImportantForAccessibility()' in class android.view.View Warning: it.sephiroth.android.library.widget.AdapterView: can't find referenced method 'void setImportantForAccessibility(int)' in class android.view.View You should check if you need to specify additional program jars. Warning: there were 9 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile them and try again. Alternatively, you may have to specify the option '-dontskipnonpubliclibraryclassmembers'. java.io.IOException: Please correct the above warnings first. at proguard.Initializer.execute(Initializer.java:321) at proguard.ProGuard.initialize(ProGuard.java:211) at proguard.ProGuard.execute(ProGuard.java:86) at proguard.ProGuard.main(ProGuard.java:492)

    Any suggestion?

    Thanks in advance. John

    opened by davanzo 3
  • ClassCastException - Adding a Footer

    ClassCastException - Adding a Footer

    In my application I have a number of fragments, most of which contain a ListView, including one with an HListView. There are two paths to the fragment with the HListView - one works without issue, and the other throws a ClassCastException. I've spent several hours trying to figure out the cause, but I can't find an answer in my code. I am not importing either of these LayoutParams, and I've made sure the ids of the layouts and layout objects are unique. Below is the log which captures the exception. Any ideas?

    FATAL EXCEPTION: main java.lang.ClassCastException: android.widget.AbsListView$LayoutParams cannot be cast to it.sephiroth.android.library.widget.AbsHListView$LayoutParams at it.sephiroth.android.library.widget.HListView.clearRecycledState(HListView.java:506) at it.sephiroth.android.library.widget.HListView.resetList(HListView.java:493) at it.sephiroth.android.library.widget.HListView.layoutChildren(HListView.java:1560) at it.sephiroth.android.library.widget.AbsHListView.onLayout(AbsHListView.java:1676) at android.view.View.layout(View.java:14016) at android.view.ViewGroup.layout(ViewGroup.java:4647) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:948) at android.view.View.layout(View.java:14016) at android.view.ViewGroup.layout(ViewGroup.java:4647) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14016) at android.view.ViewGroup.layout(ViewGroup.java:4647) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14016) at android.view.ViewGroup.layout(ViewGroup.java:4647) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14016) at android.view.ViewGroup.layout(ViewGroup.java:4647) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507) at android.widget.LinearLayout.onLayout(LinearLayout.java:1420) at android.view.View.layout(View.java:14016) at android.view.ViewGroup.layout(ViewGroup.java:4647) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14016) at android.view.ViewGroup.layout(ViewGroup.java:4647) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1879) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1700) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1005) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4243) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) at android.view.Choreographer.doCallbacks(Choreographer.java:555) at android.view.Choreographer.doFrame(Choreographer.java:525) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4777) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:998) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:765) at dalvik.system.NativeStart.main(Native Method)

    opened by Will5 3
  • Array Index of Bound Exception when trying to remove selected position

    Array Index of Bound Exception when trying to remove selected position

    java.lang.IndexOutOfBoundsException: Invalid index 59, size is 55 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at android.widget.ArrayAdapter.getItem(ArrayAdapter.java:337) at it.sephiroth.android.sample.horizontalvariablelistviewdemo.SimpleHListActivity$TestAdapter.getItemId(SimpleHListActivity.java:202) at it.sephiroth.android.library.widget.AbsHListView.confirmCheckedPositionsById(AbsHListView.java:4958) at it.sephiroth.android.library.widget.AbsHListView.handleDataChanged(AbsHListView.java:5006) at it.sephiroth.android.library.widget.HListView.layoutChildren(HListView.java:1601) at it.sephiroth.android.library.widget.AbsHListView.onLayout(AbsHListView.java:1792) at android.view.View.layout(View.java:14834) at android.view.ViewGroup.layout(ViewGroup.java:4635) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) at android.view.View.layout(View.java:14834) at android.view.ViewGroup.layout(ViewGroup.java:4635) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) at android.view.View.layout(View.java:14834) at android.view.ViewGroup.layout(ViewGroup.java:4635) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) at android.widget.FrameLayout.onLayout(FrameLayout.java:388) at android.view.View.layout(View.java:14834) at android.view.ViewGroup.layout(ViewGroup.java:4635) at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:374) at android.view.View.layout(View.java:14834) at android.view.ViewGroup.layout(ViewGroup.java:4635) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) at android.widget.FrameLayout.onLayout(FrameLayout.java:388) at android.view.View.layout(View.java:14834) at android.view.ViewGroup.layout(ViewGroup.java:4635) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1983) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1740) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761) at android.view.Choreographer.doCallbacks(Choreographer.java:574) at android.view.Choreographer.doFrame(Choreographer.java:544) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5095) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) at dalvik.system.NativeStart.main(Native Method)

    opened by rajajawahar 2
  • Item width not being handled accurately

    Item width not being handled accurately

    Setting the width to the outer most parent of my item layout, let's say, a RelativeLayout, I set the width of it to a fixed value, but it seems like this value is getting ignored, the item width is decided by the size of the views inside this RelativeLayout including padding and margin. It makes me hard to control the width of the items, not a big problem itself but I'm facing same problem with my own AdapterView(check this http://stackoverflow.com/questions/29716609/custom-adapter-view-child-not-being-measured-correctly), so I post this issue here hoping you would have any idea on this.Thanks

    opened by hubcin 2
  • Button ClickListener not working Fragment to Fragment

    Button ClickListener not working Fragment to Fragment

    I have created the 2 fragments, fragment_contact.xml and fragment_contacts3.xml along with their activity classes, fragment_contact.xml (Contact.java) as the button to which I added a clicklistener to fragment_contacts3.xml (Contacts3.java). However, the issue is that that Button click is not working as it supposed to take me to the next fragment.

    How do I resolve this issue?

    The following is the Contact.xml:

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="100dp"
        android:layout_marginRight="5dp"
        android:background="@drawable/radius"
        android:orientation="vertical"
        android:weightSum="13"
        android:backgroundTint="@color/white">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:layout_marginTop="10dp">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fontFamily="sans-serif"
                android:gravity="center"
                android:text="Enter Contact Details"
                android:textColor="@color/white"
                android:textSize="18sp"
                android:textStyle="bold" />
        </LinearLayout>
        
        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/editTextTextPersonName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:layout_margin="10dp"
            android:padding="10dp"
            android:layout_weight="2"
            android:layout_gravity="center"
            android:background="@drawable/textbox"
            android:inputType="textPersonName"
            android:hint="Enter First Name"
            android:backgroundTint="@color/offwhite"/>
        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/editTextTextPersonLName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:layout_margin="10dp"
            android:padding="10dp"
            android:layout_weight="2"
            android:layout_gravity="center"
            android:background="@drawable/textbox"
            android:inputType="textPersonName"
            android:hint="Enter First Name"
            android:backgroundTint="@color/offwhite"/>
    
    
        <RadioGroup
            android:layout_width="238dp"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <RadioButton
                android:id="@+id/radioButton7"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:layout_weight="1"
                android:buttonTint="@color/offwhite1"
                android:drawableTint="@color/offwhite1"
                android:gravity="center"
                android:padding="10dp"
                android:text="Female"
                android:textColor="@color/offwhite1" />
            <RadioButton
                android:id="@+id/radioButton6"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:layout_weight="1"
                android:backgroundTint="@color/offwhite1"
                android:buttonTint="@color/offwhite1"
                android:gravity="center"
                android:padding="10dp"
                android:text="Male"
                android:textColor="@color/offwhite1" />
    
        </RadioGroup>
        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/dob"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:layout_margin="10dp"
            android:padding="10dp"
            android:layout_weight="2"
            android:layout_gravity="center"
            android:background="@drawable/textbox"
            android:inputType="date"
            android:hint="Date of Birth:(DD/MM/YYYY)"
            android:backgroundTint="@color/offwhite"/>
    
        <Button
            android:id="@+id/nextbtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="100dp"
            android:text="Next"
            android:layout_gravity="center"
            android:clickable="true"
            android:background="@drawable/textbox"/>
    </LinearLayout>
    

    The following is the Contact.java along with clicklistener:

    package com.example.my_survey.ui.home;

    import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RadioGroup; import com.example.my_survey.R; import com.google.android.material.bottomnavigation.BottomNavigationView; import java.util.Objects;

    public class Contacts extends Fragment {

    private BottomNavigationView bottomNavigationView;
    private ImageView back;
    private RadioGroup radioGroup;
    private LinearLayout linearLayout3;
    private RadioButton bt1, bt2;
    private Button nextBtn;
    
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
    
        View view = inflater.inflate(R.layout.fragment_contacts, container, false);
        bottomNavigationView = container.getRootView().findViewById(R.id.nav_view1);
        bottomNavigationView.setVisibility(View.GONE);
        nextBtn = view.findViewById(R.id.nextbtn);
    
    
        nextBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent i;
    
              startActivity(i=new Intent(getActivity(), Contacts3.class));
            }
        });
    
        return view;
    }
    
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        bottomNavigationView.setVisibility(View.VISIBLE);
    }
    
    @Override
    public void onResume() {
        super.onResume();
        Objects.requireNonNull(((AppCompatActivity) requireActivity()).getSupportActionBar()).hide();
    }
    
    @Override
    public void onStop() {
        super.onStop();
        Objects.requireNonNull(((AppCompatActivity) requireActivity()).getSupportActionBar()).hide();
    
    }
    
    @Override
    public void onDestroy() {
        super.onDestroy();
        Objects.requireNonNull(((AppCompatActivity) requireActivity()).getSupportActionBar()).show();
    }
    

    }

    opened by mwapevi 0
  • lock(freeze) the scroll

    lock(freeze) the scroll

    We use function disableScroll in early version, but in version 1.2.2, there is no disableScroll. Now we use setEnabled(false) but it still can be scrolled a little(not totally freeze) Please teach us how we can solve it? Thank you very much!

    opened by EggsyChiang 0
  • FloatMath.sqrt has been removed from Android SDK 23

    FloatMath.sqrt has been removed from Android SDK 23

    The deprecated class has been removed.

    "Historically these methods were faster than the equivalent double-based Math methods. On versions of Android with a JIT they became slower and have since been re-implemented to wrap calls to Math. Math should be used in preference. All methods were removed from the public API in version 23."

    http://developer.android.com/reference/android/util/FloatMath.html

    The library now needs to use eg. (float) Math.sqrt(pvxpvx + pvypvy);

    opened by dominicthomas 4
Owner
Alessandro Crugnola
Alessandro Crugnola
This is a very simple library for Android that allows you to stick an header to a scrollable view and easily apply animation to it

StikkyHeader This is a very simple library for Android that allows you to stick an header to a ListView and easily apply animation to it Usage To use

Carlo Marinangeli 847 Dec 30, 2022
An easy to use Drag & Drop List for Android. Direct replacement of the android ListView.

DragNDropListView DragNDropListView is a direct replacement for the stock Android ListView. If you know how to use ListView, you already know how to u

null 187 Dec 22, 2022
A better ExpandableListView, with animated expandable views for each list item

SlideExpandableListView for Android Not happy with the Android ExpandableListView android offers? Want something like the Spotify app. This library al

Tjerk Wolterink 2k Dec 22, 2022
Android library that allows you to bind a LinearLayout with a ListAdapter.

LinearListView Android library that allows you to bind a LinearLayout with a ListAdapter. Download Gradle: dependencies { compile 'com.github.franki

Francesco Sardo 571 Dec 22, 2022
AssignmentListView is an Android ListView widget which calculate image loading times.

AssignmentListView is an Android ListView widget which calculate image loading times.

null 5 Sep 9, 2022
A small android library for tagging views inside a ScrollView as "sticky" making them stick to the top of the scroll container until a new sticky view comes and takes it's place

StickyScrollViewItems StickyScrollViewItems is a ScrollView subclass that allowed you to mark items inside the ScrollView as sticky. The items marked

Emil Sjölander 1k Jan 7, 2023
An open source Android library that provides a floating group view at the top of the ExpandableListView

FloatingGroupExpandableListView FloatingGroupExpandableListView is a huge name an open source Android library that provides a floating group view (aka

Diego Lima 376 Nov 28, 2022
StackExpandableView - A custom view that resembles the iOS notification group behavior

StackExpandableView - A custom view that resembles the iOS notification group behavior

Fabio Sassu 155 Dec 15, 2022
Expandable Recyclerview makes it easy to integrate nested recycler view...🔨 📝

SSExpandableRecyclerView Expandable Recyclerview make it easy to integrate nested recyclerview Features Simple and easy to use ( no complex adapter re

Simform Solutions 52 Nov 1, 2022
Android library to observe scroll events on scrollable views.

Android-ObservableScrollView Android library to observe scroll events on scrollable views. It's easy to interact with the Toolbar introduced in Androi

Soichiro Kashima 9.6k Dec 30, 2022
An android library for section headers that stick to the top

StickyListHeaders StickyListHeaders is an Android library that makes it easy to integrate section headers in your ListView. These section headers stic

Emil Sjölander 5.5k Jan 5, 2023
Easy to use ListView with pinned sections for Android.

Easy to use ListView with pinned sections for Android 2.1 and higher. Pinned section is a header view which sticks to the top of the list until at lea

Sergej Shafarenka 2.6k Dec 21, 2022
This project aims to provide a reusable pull to refresh widget for Android.

Pull To Refresh for Android Note This library is deprecated, a swipe refresh layout is available in the v4 support library. This project aims to provi

Johan Berg 2.5k Jan 2, 2023
An Android custom ListView and ScrollView with pull to zoom-in.

PullZoomView An Android custom ListView and ScrollView with pull to zoom-in. Features Set ZoomView enable Add HeaderView Custom ZoomView Parallax or N

Frank-Zhu 2.3k Dec 26, 2022
Lazy load of images in Android

LazyList A simple library to display images in Android ListView. Images are being downloaded asynchronously in the background. Images are being cached

Fedor Vlasov 1.2k Nov 15, 2022
Android widget with pull to refresh for all the views,and support loadMore for ListView , RecyclerView, GridView and SwipeRefreshLayout.

CommonPullToRefresh Android widget with pull to refresh for all the views,and support loadMore for ListView,RecyclerView,GridView and SwipeRefreshLayo

null 1.1k Nov 10, 2022
Android library to achieve in an easy way, the behaviour of the home page in the Expedia app, with a pair of auto-scroll circular parallax ListViews.

ListBuddies This library is not maintained anymore and there will be no further releases Android library of a pair of auto-scroll circular parallax Li

JPARDOGO 970 Dec 29, 2022
A ListView with pinned section headers for Android

PinnedHeaderListView This library provides a sectioned ListView with pinned headers. It looks and feels much like the default contacts app does on And

James Smith 665 Nov 29, 2022
A generic, customizable, open source Android ListView implementation that has 'Pull to Refresh' functionality.

Android 'Pull to Refresh' ListView library Demo video: http://www.youtube.com/watch?v=VjmdELnm3GI Project A generic, customizable, open source Android

Erik Wallentinsen 639 Nov 17, 2022