I cannot find out why the viewpagerindicator does not shows up on the screen when is put below the viewpager on the activity layout.
On the layout file of the activity I have a ViewPager follow by a ViewPagerIndicator. The ViewPagerIndicator does not appear. If I change the order of the elements, first the viewpagerindicator and then viewpager it works.
The activity layout has:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <android.support.v4.view.ViewPager android:id="@+id/menuPager" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <dk.ostebaronen.droid.viewpagerindicator.CirclePageIndicator android:id="@+id/indicator" android:padding="10dip" android:layout_height="wrap_content" android:layout_width="fill_parent" android:background="#FFCCCCCC" app:radius="5dp" app:fillColor="#FF888888" app:pageColor="#88FF0000" app:strokeColor="#FF000000" app:strokeWidth="2dp" /> </LinearLayout>
The layout file of the fragment that the viewpager has:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:layout_width="160dp" android:layout_height="160dp" android:id="@+id/imgMenu" android:scaleType="fitXY" android:layout_gravity="center_horizontal" /> <TextView android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txtMenuName" android:gravity="center" android:layout_margin="10dp" /> <TextView android:text="Small Text" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/txtMenuDescription" android:gravity="center" android:layout_margin="10dp" /> <TextView android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtMenuPrice" android:gravity="center" android:layout_margin="10dp" android:textColor="#ff07df1c" android:layout_marginLeft="15dp" /> </LinearLayout>
The target version I’m using is API Level 15.
Why does the ViewPagerIndicator does not appear when is below the viewpager?
Posts
Solve it.
http://stackoverflow.com/questions/25516974/viewpager-on-xamarin-android-hugging-all-the-screen
Set the height of the viewpager to 0dp.