android-viewflow
android-viewflow copied to clipboard
CircleFlowIndicator not showing with certain width/heights
I'm having a very strange problem with the CircleFlowIndicator. I'm using ViewFlow to create a gallery of products, and using the CircleFlowIndicator to show how much products we have.
However, if I set the indicator height/width both to "wrap_contents", then the indicator is not shown in the view. If I set the width to some value, for instance, 10dp, then it shows. However, if there are 3 products, the indicator is not centered.
What is more bizarre is that if I inspect the layout using ADT's Hierarchy Viewer, when I click "Load all views" the indicator shows up and works like a charm!
Can you help me on this? My customer really wants the circle indicator, and I'm banging my head in a wall here...
Thx!
Have you looked at the examples? The circle flow example uses wrap_content and shows up as expected. Make sure there is nothing else in your layout that is causing this behaviour.
I have copied the layout exactly like the example. That's why I find it odd.
The only difference is that in your example, the view that is shown inside the viewFlow is a LinearLayout with a ScrollView, while mine is a LinearLayout with a bunch of TableLayouts; could this be the cause?
It has most likely nothing to do what's inside your viewflow but rather how the parent layout looks like. The layout that contains the indicator and the viewflow. In the example, they both live in a FrameLayout. Which might not really be the way you want. Try adding them to a vertical oriented LinearLayout instead. But it's hard to give any advice without having a look at the layout xml.
This is my parent layout. I tried switching it to a LinearLayout, but still no indicator is shown. With width=70dp the circles are shown, however, not centered with few elements.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/my.app.pack" android:layout_width="fill_parent" android:layout_height="130dp" android:background="#FFFFFF">
<org.taptwo.android.widget.ViewFlow
android:id="@+id/viewflow"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
app:sidebuffer="3"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"/>
<org.taptwo.android.widget.CircleFlowIndicator
android:id="@+id/viewflowindic"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
app:activeColor="#00bfff"
app:inactiveColor="#1e90ff"
app:inactiveType="stroke"
app:radius="3.5dp"
android:visibility="visible"
android:layout_marginBottom="10dp"/>
Are you using Eclipse? Try select the CircleFlowIndicator in the Layout Editor and show should see where it's located. If it has been pushed down, outside the screen by the ViewFlow. Try moving the indicator above the ViewFlow just to see what happens.
Yes, I'm using Eclipse. I tried your suggestion, but still nothing. The indicator was inside the ViewFlow widget. I moved it down, and reduced the ViewFlow's height, so the indicator could still be underneath it. Still no luck..
What is bothering me is that your example works very well with wrap_contents. And also, the indicator appears if I use ADT's HierarchyView and load all views. This does not makes sense...
Thanks for your help!
2012/1/27 Patrik kerfeldt < [email protected]
Are you using Eclipse? Try select the CircleFlowIndicator in the Layout Editor and show should see where it's located. If it has been pushed down, outside the screen by the ViewFlow. Try moving the indicator above the ViewFlow just to see what happens.
Reply to this email directly or view it on GitHub:
https://github.com/pakerfeldt/android-viewflow/issues/60#issuecomment-3694021
Francisco A. Cavedon - SCJP [email protected]