[android-developers] Using multiple listview inside one activity, how to give focus to each
hi All,
I'm using multiple listViews inside one activity. I'm using each listiview in its own UI screen layout, meaning I've two UI screens. Now when I start the app, I get the focus on the first app as I'm able to scroll down/up the list and when I switch to the 2nd listview in the 2nd UI screen, the second listView works fine and I'm able to scroll the list. Next, when I return back from the 2nd listview UI screen page to the first page screen, the list becomes static/freezed and I'm not able to scroll up/down but surprisingly when I return back to the 2nd listView, it still works fine. I'm not able to understand as to why both the listViews work fine initially but after returning back from the 2nd listView the 1st listView stops working/scrolling. To me it feels as if something is locked in 1st listView, when I'm returning back from the 2nd one and we've to enable some short of flag, by saying "enable this listView from scrolling/usage as currently this listView is in focus on screen". Would appreciate if someone could point me to the right direction. I'm adding some code snippets below,
--------------------------------------
Activity file code snippet
--------------------------------------
layout01 = (LinearLayout) findViewById(R.id.Layout1);
layout02 = (LinearLayout) findViewById(R.id.Layout2);
layout02.setVisibility(View.GONE);
..........................
listView1 = (ListView) findViewById(R.id.list1);
listView2 = (ListView) findViewById(R.id.list2);
this.adapter = new MovieAdapter(this);
listView1.setAdapter(this.adapter);
listView1.setItemsCanFocus(false);
listView2.setAdapter(new MovieAdapter(this));
listView2.setItemsCanFocus(false);
-------------------------------------------------
main.xml layout file:
---------------------------------
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Layout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="75px"
android:scaleType="fitXY"
android:src="@drawable/title" />
<ListView
android:id="@+id/list1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
<LinearLayout
android:id="@+id/Layout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="75px"
android:scaleType="fitXY"
android:src="@drawable/title" />
<ListView
android:id="@+id/list2"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</FrameLayout>
Appreciate your time.
Thanks,
KK
-- You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home