I have created a Gallery View with 2 Views with 3 simple TextViews to present some
of the data from my data model.
Upon calling the Invalidate method on the 2 Views it is like the
Views lose focus, the same case when I navigate in the Gallery View.
The text becomes almost unreadable after the “focus” is lost. (See the two pictures below)
I am using Monodroid, but regular Android examples are appreciated as well.
The code for my Gallery View:
<?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">
<Gallery
android:id="@+id/locationGallery"
android:layout_height="match_parent"
android:layout_width="fill_parent">
</Gallery>
</LinearLayout>
Code for the two Views I put into the Gallery View:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="3sp"
android:id="@+id/locationGalleryItem"
>
<TextView
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="16sp"
/>
<TextView
android:id="@+id/text2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/text1"
android:padding="10dp"
android:textSize="16sp"
/>
<TextView
android:id="@+id/text3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/text2"
android:padding="10dp"
android:textSize="16sp"
/>
</LinearLayout>


I fixed the problem by making an EventHandler for the ItemSelected property on the Gallery View. This EventHandler tracks the current position of the Gallery View. Then invokes the method SetSelection on the Gallery View to the current position. This gives the desired result.
Code: