views:

27

answers:

1

I am using gallery as below

   <Gallery android:nextFocusUp="@+id/zoom_out"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/icon_gallery_plate" android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:spacing="10dip"
    android:background="@drawable/browse_slider_bar"
    android:unselectedAlpha="0.5" android:layout_alignBottom="@+id/layoutZoom" 
    />

Problem is as i defined nextFocusup zoom out when i press up key while on the gallery it don't focus to zoom out.

A: 

found solution add nextfocusup id in adatper's getview method.

@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        /* calculationg position */
        ImageView i = new ImageView(mContext);
        i.setScaleType(ImageView.ScaleType.FIT_CENTER);
        BrowseMapCategoryRow catRow = getItem(position);
        /* Replacing with selected image */
        i.setImageResource(catRow.getImageSource());
        i.setNextFocusUpId(R.id.zoom_out); // setting manullay
        return i;
    }
Faisal khan