Ok I see that the stream is dead, but I know how to do it.
My xml file layout:
<?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="horizontal" > <RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" > <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="55dp" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" > </RelativeLayout> <ListView android:id="@+id/ListView01" android:layout_width="192px" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_toRightOf="@+id/relativeLayout1" android:layout_weight="1" > </ListView> </RelativeLayout> <RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" > <RelativeLayout android:id="@+id/relativeLayout2" android:layout_width="55dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_alignParentTop="true" > </RelativeLayout> <ListView android:id="@+id/ListView02" android:layout_width="192px" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_toLeftOf="@+id/relativeLayout2" android:layout_weight="1" > </ListView> </RelativeLayout> </LinearLayout>
My second code is from activity:
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); setContentView(R.layout.main); ListView lv1=(ListView)this.findViewById(R.id.ListView01); ListView lv2=(ListView)this.findViewById(R.id.ListView02); File fCurrDirOne = new File ("/"); File fCurrDirTwo = new File ("/"); String[] mListOfFilesOne = fCurrDirOne.list(); String[] mListOfFilesTwo = fCurrDirTwo.list(); ArrayAdapter list1 = new ArrayAdapter<String>( this, R.layout.itemlistview,mListOfFilesOne); ArrayAdapter list2 = new ArrayAdapter<String>( this, R.layout.itemlistview,mListOfFilesTwo); lv1.setAdapter(list1); lv2.setAdapter(list2); }
Enjoy)
PS you have to create layuot for your list items, my called itemlistview.xml, and you can use android.R.layout.simple_list_item_1 by default.
Itemlistview.xml file
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20dp" > </TextView>
Sim mak
source share