QSL4A Documentation of
fullSetList2 <QSL4A API Menu>fullSetList2(id,list,intRes)
Attach a 2-line list to a fullscreen widget
Needs to run droid.fullShow first .
id (String) id of layout widget
list (JSONArray) List to set like [1Up,1Down,2Up,2Down,……]
intRes (JSONArray) constant integer like :
[R.layout.simple_list_item_2,R.id.text1,R.id.text2]
[R.layout.simple_list_item_1,R.id.text1]
[R.layout.simple_spinner_item,R.id.text1,R.layout.simple_spinner_dropdown_item]
[R.layout.simple_expandable_list_item_2,R.id.text1,R.id.text2]
[R.layout.simple_expandable_list_item_1,R.id.text1]
[R.layout.simple_spinner_dropdown_item,R.id.text1,R.layout.simple_spinner_item]
R is (
from androidhelper.R import R
R=R()
) or (
from androidhelper import Android
droid=Android()
R=droid.R
)
===== Example of fullSetList2 =====
XML='''<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<ListView
android:id="@+id/list1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<Spinner
android:id="@+id/list2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#303000"
/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Exit"
android:id="@+id/button_exit"
android:textAllCaps="false"
android:gravity="center"
android:layout_weight="2"
/>
</LinearLayout>'''
from androidhelper import Android
droid = Android()
R = droid.R
droid.fullShow(XML,"Hello QPython",R.style.Theme_Holo)
droid.fullSetList2('list1',['1Up','1Down','2Up','2Down','3Up','3Down'],[R.layout.simple_list_item_2,R.id.text1,R.id.text2])
droid.fullSetList2('list2',['Item1','Item2','Item3','Item4'],[R.layout.simple_spinner_item,R.id.text1,R.layout.simple_spinner_dropdown_item])
while True:
event=droid.eventWait().result
print(event)
data=event['data']
if type(data)==str:
break
data_id=data.get('id')
if data_id=='button_exit':
break
print()
print('list2_menu_position',droid.fullGetProperty('list2','selectedItemPosition'))
droid.fullDismiss()