Giter Site home page Giter Site logo

carouselview's People

Contributors

appspell avatar calebmacdonaldblack avatar flibbertigibbet avatar foxsake avatar jaesga avatar leonardo2204 avatar longstone avatar mfsi-raghavg avatar mrehan27 avatar nutomic avatar renaudlenne avatar sayyam avatar ukonpete avatar veinhorn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carouselview's Issues

How can I get current page index?

I checked the code and found that CirclePageIndicator has mCurrentPage variable.
We can use it but it's private.
Can we make a public function to get it?

Error when try change data on execution time

Hello, I have a problem with library when I try change the data on execution time.
Well, I am trying change the views every minute, I mean, I have a timer that execute next code every minute:
getActivity().runOnUiThread(new Runnable() {
@OverRide
public void run() {
try {
messageArrayList = gson.fromJson(new MessageTask().execute("").get(), new TypeToken<ArrayList>(){}.getType());
customCarouselView = (CarouselView) rootView.findViewById(R.id.carouselView);
customCarouselView.setPageCount(2);
customCarouselView.setViewListener(new ViewListener() {
@OverRide
public View setViewForPosition(int position) {
View custom = inflater.inflate(R.layout.message_template, null);
TextView title = (TextView) custom.findViewById(R.id.title_message);
TextView body = (TextView) custom.findViewById(R.id.body_message);
title.setText(messageArrayList.get(position).getTitulo_mensaje());
body.setText(messageArrayList.get(position).getMensaje());
return custom;
}
});
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
});

But, If this code is executed on AsyncTask I get next error:
Theme: themes:{default=overlay:com.wsdeveloper.galaxy, iconPack:com.wsdeveloper.galaxy, fontPkg:com.wsdeveloper.galaxy, com.android.systemui=overlay:com.wsdeveloper.galaxy}
java.lang.RuntimeException: View must set ImageListener or ViewListener.
at com.synnapps.carouselview.CarouselView$CarouselPagerAdapter.instantiateItem(CarouselView.java:325)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1001)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1149)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1083)
at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:538)
at com.synnapps.carouselview.CarouselView.setData(CarouselView.java:231)
at com.synnapps.carouselview.CarouselView.setPageCount(CarouselView.java:411)
at com.isotader.claire.SummaryFragment$5.run(SummaryFragment.java:158)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5466)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

What happens here?

This error appears just in this line:
customCarouselView.setPageCount(2);

Thanks

Should expose getCurrentItem()

It is possible to setCurrentItem(), but not to get it. This should be implemented to find out which item is currently selected.

Loading web URLS (Images)

Can I use web URLS as images instead of calling images like below int[] sampleImages = {R.drawable.slide_1, R.drawable.slide_2};

How to hide indicator?

Hello All,

I want to hide indicator view. Any idea how to get this done?

Thanking You,

Fahim Parkar

Keep images from filling space

I'm using Picasso with fit().centerInside(), but it only scales as much as the smaller dimension, meaning the top and bottom of my images are cropped. Is there a way to get around this? I don't want it to fill the space.

My dimensional settings are the same as the example, but my images are taller than they are wide.

Failed to resolve

my setup

compileSdkVersion 23
buildToolsVersion "23.0.3"

and

compile 'com.android.support:appcompat-v7:23.4.0'

Infinite scroll

Nice piece of code you have there 👍
Is there any plan to add looping (infinite scrolling) to the Carousel?

Thanks

Proguard config file?

I get the following exception upon launch when using ProGuard. Any ideas?

android.view.InflateException: Binary XML file line #97: Error inflating class com.synnapps.carouselview.CarouselView

Downloaded source files can't find XML "app:" attributes?

I've downloaded the source because I want to modify a view things (such as letting the ViewListener return null if I want to dynamically check whether I want to load a page or not) but when I am using the source files it can't find the "app:" attributes such as app:centered, app:strokeWidth etc.

Am I going about this the wrong way?

CarouselView crashes if setPageCount() is called before setImageListener()

This means the example code in the readme doens't work. Crash log:

java.lang.RuntimeException: View must set ImageListener or ViewListener.
    at com.synnapps.carouselview.CarouselView$CarouselPagerAdapter.instantiateItem(CarouselView.java:325)
    at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1006)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1154)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1088)
    at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:542)
    at com.synnapps.carouselview.CarouselView.setData(CarouselView.java:231)
    at com.synnapps.carouselview.CarouselView.setPageCount(CarouselView.java:411)
    at global.snappy.android.fragments.FeaturedFragment.updateCollections(FeaturedFragment.java:31)
    at global.snappy.android.fragments.FeaturedFragment.access$lambda$0(FeaturedFragment.java)
    at global.snappy.android.fragments.FeaturedFragment$$Lambda$1.onSuccess(Unknown Source)
    at global.snappy.android.model.Collection.lambda$fetch$0(Collection.java:42)
    at global.snappy.android.model.Collection$$Lambda$1.onSuccess(Unknown Source)
    at global.snappy.android.network.ServerRequest.onPostExecute(ServerRequest.java:122)
    at global.snappy.android.network.ServerRequest.onPostExecute(ServerRequest.java:31)
    at android.os.AsyncTask.finish(AsyncTask.java:651)
    at android.os.AsyncTask.-wrap1(AsyncTask.java)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5461)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Library version: 0.0.9
Android version: 6.0

why this happens?

Caused by: java.lang.NoSuchMethodError: No virtual method addOnPageChangeListener(Landroid/support/v4/view/ViewPager$OnPageChangeListener;)V in class Landroid/support/v4/view/ViewPager;

Indicator position Top

Just a minor suggestion. It would be nice to add XML attribute to position the indication to the top of CarouselView instead of bottom.

indicatorGravity:center_horizontal isn't working as expected

Hi guys, I want to center horizontal the indicators but when I try to do it the indicators go to the top left corner

<com.synnapps.carouselview.CarouselView
android:id="@+id/carouselView"
android:layout_width="match_parent"
android:layout_height="200dp"
app:fillColor="#FFFFFFFF"
app:pageColor="#00000000"
app:radius="6dp"
app:slideInterval="3000"
app:strokeColor="#FF777777"
app:strokeWidth="1dp"
app:indicatorOrientation="horizontal"
app:indicatorGravity="center_horizontal"
app:pageTransformer="slide_over" />

And this the result
https://postimg.org/image/jglj2sg4v/

Is there a way to solve it?

thanks in advance guys

Loading urls using Glide

Hi
Loading images from drawable works yes, but when you try with big images it causes memory leaks and crash. I tried loading using Glide or picasso

ImageListener imageListener = new ImageListener() { @Override public void setImageForPosition(int position, ImageView imageView) { Glide.with(context).load(url).into(imageView) } };

But it doesn't load anything. Any idea how to load from urls ?

ViewPager issue when using PhotoView inside CarouselView

I am using PhotoView inside CarouselView. It has known issue with ViewPager.
So i have to use extender CarouselViewPager so that exceptions do not crash the whole application.

public class HackyCarouselViewPager extends CarouselViewPager {

    public HackyCarouselViewPager(Context context) {

        super(context);
    }

    public HackyCarouselViewPager(Context context, AttributeSet attrs) {

        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        try {
            return super.onTouchEvent(ev);
        } catch (IllegalArgumentException ex) {
            ex.printStackTrace();
        }
        return false;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        try {
            return super.onInterceptTouchEvent(ev);
        } catch (Throwable t) {
            t.printStackTrace();
            return false;
        }
    }
}

Maybe you could add above overriden onInterceptTouchEvent() and onTouchEvent() already in your library.

How to hidde indicator?

I am trying hidde the indicator of page, but I can't some method that do it.

There is some way to hidde indicator?

Thanks!

getCurrentItem

setCurrentItem has been very useful thus far, but is a "getter" possible as well, if a solution doesn't already exist? I would like to know which image the user sees on the carousel for a variety of purposes, such as making a button appear on the screen separately from the carousel itself when the user views a particular item.

Thank you!

Error inflating class com.synnapps.carouselview.CarouselView

I have implemented this library in my app, I tested it using Device Emulator and a real device (Galaxy S5), everything was working well so I updated my app. After a few hours I downloaded my app from Play Store and I noticed that it crashes when I open the activity containing the carouselview.

Crash report:

java.lang.RuntimeException: Unable to start activity MncDetails{com.mypackage}: android.view.InflateException: Binary XML file line #35: Error inflating class com.synnapps.carouselview.CarouselView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2449)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2509)
    at android.app.ActivityThread.access$900(ActivityThread.java:172)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5694)
    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:1291)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class com.synnapps.carouselview.CarouselView
...

I added this line -keep class com.synnapps:carouselview.** { *; } to proguard-rules.pro but I'm still getting that error.

FATAL EXCEPTION

Hi,

I'm trying to set the library normally but I'm having a fatal exception thrown at this point carouselView.setPageCount(sampleImages.length);
Here is the error
FATAL EXCEPTION: main Process: com.iwooli.xxxxxx, PID: 28670 java.lang.RuntimeException: View must set ImageListener or ViewListener.

Swiping back to start or in loop

I am using the carouselview inside a viewpager and when i swipe from the last slide it don't go back to the first, it change the page from viewpager.

Here the fragment where i am using a carouselview.

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/home_frame_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="layout.HomeFragment">

    <com.wiplojas.enfoquearapongas.customViews.CustomSwipeToRefresh
        android:id="@+id/home_refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ScrollView
            android:id="@+id/home_scroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <com.synnapps.carouselview.CarouselView
                    android:id="@+id/home_carousel"
                    android:layout_width="match_parent"
                    android:layout_height="200dp"
                    app:indicatorGravity="bottom|center_horizontal"
                    app:slideInterval="5000" />

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/home_recycler"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="4dp"/>
            </LinearLayout>
        </ScrollView>
    </com.wiplojas.enfoquearapongas.customViews.CustomSwipeToRefresh>
</FrameLayout>

Whenever the fragment where the carousel is gain focus, it scrolls off screen.

I am using a the carouselview in a fragment.

When i go back to the page where the carousel view is the scrollview jump to after the carouselview.
But i also display a dialog asking if the user want notification and when it closes the same, so i assume that whenever the fragment where the carousel view is gain focus, this bug happens.

It's a very weird behavior.

Demo picture of carousel view in use

Hi,

Nice project! I thought it would be nice if you could add a demo picture in the README.md file of the carouselview in use, so that we can see how it looks like and functions.

Thanks.

Android Studio compile error

Error:Failed to find: com.android.support:appcompat-v7:23.2.1
I am getting this error when i am adding your library in android studio.
Any fix for this ?

Scroll not working correctly in RecyclerView

I'm using CarouselView as item in a RecyclerView. When I scroll between the RecyclerView elements, the behaviour is buggy: The image and indicator stop scrolling as soon as I lift my finger. So the CarouselView is stuck in the middle between two images. However, onPageSelected() is called correctly. Also, scrolling works correct if I scroll slowly (it snaps only within a few pixels of the final position).

Here's a video of the behaviour:
https://dl.dropboxusercontent.com/u/22457329/scrolling.mp4

Does anyone have an idea how I can fix this problem?

JNI ERROR (app bug): local reference table overflow (max=512)

I ran into this strange overflow using the library:

Last 10 entries (of 512):
511: 0x12de4180 ....view.activity.SomeDetailsActivity (edited from original)
510: 0x147bd820 java.lang.String "com.synnapps.car... (38 chars)
509: 0x14865000 com.synnapps.carouselview.CarouselView
508: 0x12de4180 ....view.activity.SomeDetailsActivity (edited from original)
507: 0x14865000 com.synnapps.carouselview.CarouselView
506: 0x14864c00 com.synnapps.carouselview.CarouselView
505: 0x14864800 com.synnapps.carouselview.CarouselView
504: 0x14864400 com.synnapps.carouselview.CarouselView
503: 0x14864000 com.synnapps.carouselview.CarouselView
502: 0x14863c00 com.synnapps.carouselview.CarouselView
Summary:
2 of ...view.activity.SomeDetailsActivity (1 unique instances)
502 of com.synnapps.carouselview.CarouselView (501 unique instances)

...and it took me some time to realize that I've extracted the CarouselView layout into a separate layout file called view_carousel.xml which I later noticed that you use in the actual library. I've renamed the xml file and now everything works fine. So, the issue is for anyone that happens to be struggling with it.

app:indicatorGravity XML attribute possible bug

If I set XML attribute app:indicatorGravity="center_horizontal" app:indicatorGravity="top|center_horizontal" then indicator disappears.

I'm using version 0.0.7

I know this library is quite new, so I'm sorry if I'm reporting bugs that you already know about. Just in case. :)

fit Width and scale height of CarouselView to show all image

how can i show all the image without cut any part of image?, i want to download the images from internet with glide, and place it inside the carousel, but when i do it, the image gets cropped on the bottom or on sides(thats beacuse Carouselview has a fixed height and widht variates with screen size), any way to only scale the carouselview height to fit image?(if i set height on wrapcontent the view disapears)how can i acomplish that?

OnClickListener not being fired

I've tried to set an OnClickListener onto this CarouselView both on the CarouselView itself and a RelativeLayout that I wrapped around the CarouselView. The OnClick never gets fired. I have added android:clickable="true" to the XML but it's still not getting fired. I have set an OnClickListener. I have also tried using android:onClick.

Is there something I need to override to make this possible?

Current position

Hi! There is a way to get the current position of the selected page in the CarouselView ?

I need to change programmatically the selected page to the next o previous.

Thanks!

How to change Indicator Margin?

I want to move the indicator by changing the margin. How can I achieve that?
I used app:indicatorMarginVertical but the app will crash.

07-13 17:47:29.199 18422-18422/ E/AndroidRuntime: FATAL EXCEPTION: main Process: , PID: 18422 java.lang.RuntimeException: Unable to start activity ComponentInfo{/.project.ProjectActivity}: android.view.InflateException: Binary XML file line #29: Binary XML file line #29: Error inflating class com.synnapps.carouselview.CarouselView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: android.view.InflateException: Binary XML file line #29: Binary XML file line #29: Error inflating class com.synnapps.carouselview.CarouselView at android.view.LayoutInflater.inflate(LayoutInflater.java:539) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at .project.ProjectActivity.onCreate(ProjectActivity.java:31) at android.app.Activity.performCreate(Activity.java:6237) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class com.synnapps.carouselview.CarouselView at android.view.LayoutInflater.createView(LayoutInflater.java:645) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  at .project.ProjectActivity.onCreate(ProjectActivity.java:31)  at android.app.Activity.performCreate(Activity.java:6237)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at android.view.LayoutInflater.createView(LayoutInflater.java:619) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  at .project.ProjectActivity.onCreate(ProjectActivity.java:31)  at android.app.Activity.performCreate(Activity.java:6237)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  Caused by: java.lang.NumberFormatException: Invalid int: "10.0dip" at java.lang.Integer.invalidInt(Integer.java:138) at java.lang.Integer.parse(Integer.java:410) at java.lang.Integer.parseInt(Integer.java:367) at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:133) at android.content.res.TypedArray.getInt(TypedArray.java:355) at com.synnapps.carouselview.CarouselView.initView(CarouselView.java:94) at com.synnapps.carouselview.CarouselView.<init>(CarouselView.java:66) at java.lang.reflect.Constructor.newInstance(Native Method)  at android.view.LayoutInflater.createView(LayoutInflater.java:619)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  at .project.ProjectActivity.onCreate(ProjectActivity.java:31)  at android.app.Activity.performCreate(Activity.java:6237)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

ViewListener example

Hi,

I have the following custom view:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center">

    <ImageView
        android:id="@+id/fruitImageView"
        android:layout_width="fill_parent"
        android:layout_height="450dp"
        android:scaleType="centerCrop" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_below="@+id/fruitImageView"
        android:background="#bdbdbd">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="44dp"
            android:textAppearance="?android:attr/textAppearanceLarge"
            style="@style/TextView.Label"
            android:text="Large Text"
            android:id="@+id/labelTextView"
            android:layout_centerHorizontal="true"
            android:textStyle="normal"
            android:textColor="#000000"
            android:layout_gravity="center_horizontal|bottom" />
    </FrameLayout>

</RelativeLayout>

and set customCarouselView.setViewListener(viewListener);

ViewListener viewListener = new ViewListener() {
@OverRide
public View setViewForPosition(int position) {

        View customView = getActivity().getLayoutInflater().inflate(R.layout.carousel_custom, null);

        TextView labelTextView = (TextView) customView.findViewById(R.id.labelTextView);
        ImageView fruitImageView = (ImageView) customView.findViewById(R.id.fruitImageView);

        fruitImageView.setImageResource(sampleImages[position]);
        labelTextView.setText(sampleTitles[position]);

        customCarouselView.setIndicatorGravity(Gravity.CENTER_HORIZONTAL| Gravity.BOTTOM);

        return customView;
    }
};

however the image title is not displayed. Any ideas?

Not adding page to Carousel on load

I dynamically load data into my Carousel but if a String matches one that is dynamically picked up via GPS I want the Carousel to not instantiate that page. I've tried using removeViewAt in setViewForPosition but the page hasn't been loaded by this point.

In PagerAdapter.instantiateItem I replaced the throw of the exception with "return null" but all that happens is there is a blank page where I want there to be no page but there is a page afterwards. How do I completely remove this blank page?

Set the custom views dynamically

i was wondering if was it possible to fetch the objects from a data source (server for instance) and use them to populate the carouselview ??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.