protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
ScrollView sv = new ScrollView(this);
ViewGroup.LayoutParams svLp = new ScrollView.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
LinearLayout ll = new LinearLayout(this);
ll.setLayoutParams(svLp);
sv.addView(ll);
isv = new ChapterListView(this, extras);
isv.setOnClickListener(mList);
boolean b = isv.isFocusableInTouchMode();
b = isv.isFocusable();
isv.requestFocus();
b = isv.isFocused();
int screenHeight = getWindowManager().getDefaultDisplay().getHeight
();
LinearLayout.LayoutParams llLp = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
12 * screenHeight); // 2x screen height to ensure scrolling
isv.setLayoutParams(llLp);
ll.addView(isv);
setContentView(sv);
isv.requestFocus();
}
i created a new view ChapterListView in the ScrollView
i used requestFocus() for the chaterview , but that can't get the
focus , isFocused() is false.
i tested the chapterview isFocusableInTouchMode() is false.
In the view press the key and into focuschanged function , the view
get the focus
protected void onFocusChanged(boolean focused, int direction,
Rect previouslyFocusedRect) {
super.onFocusChanged(focused, direction, previouslyFocusedRect);
}
why i can't set default focus for the chapterview?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---