I want to user gallery to slide view.It was work well.But when Gallery item
has two EditText View,When I click the second EditText ,The first Edittext
always get focus.why?
The follow is my gallery xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<com.baiboom.MyGallery
android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
The follow file is my Gallery Item
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/autotext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:singleLine="true"
android:textColor="#5B5B5B"
android:textSize="15sp" />
<EditText
android:id="@+id/consumecalories"
android:layout_width="180dp"
android:layout_height="45dp"
android:layout_marginLeft="10dp"
android:inputType="numberDecimal"
android:textColor="#5B5B5B"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
The Follow file is my Gallery
public class MyGallery extends Gallery {
public MyGallery(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initCustomGallery(context);
// TODO Auto-generated constructor stub
}
public MyGallery(Context context, AttributeSet attrs) {
super(context, attrs);
initCustomGallery(context);
// TODO Auto-generated constructor stub
}
public MyGallery(Context context) {
super(context);
initCustomGallery(context);
// TODO Auto-generated constructor stub
}
private static final int DRAG_BOUNDS_IN_DP = 20;
private static final int SCROLL_LOCK_NONE = 0;
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
boolean handled = false;
if (getFocusedChild() != null) {
handled = getFocusedChild().dispatchKeyEvent(event);
}
if (!handled) {
handled = event.dispatch(this, null, null);
}
return handled;
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en