QSL4A Documentation of
fullSetList <QSL4A API Menu>fullSetList(id, list, isHtml=False, listType=fullSetList.SIMPLE)
Attach a text/html list to a fullscreen widget.
Needs to run droid.fullShow first .
• id (String) :
The ID of the layout widget to attach the list.
• list (Message List of String or Dictionary) :
* The list of items to display.
* String: A plain text string.
* Dictionary: An object with the following documented keys:
- msg (String Optional) : The content to display. If omitted, displays a blank line.
- bg (String Optional) : Background color (Hex format, e.g., "#RRGGBB", "#AARRGGBB").
- fg (String Optional) : Foreground color (Text color, Hex format, e.g., "#RRGGBB", "#AARRGGBB").
• isHtml (Boolean, Optional, Default=False) :
If True , treats the message (List of String or List of Dictionary with the msg field) as HTML. If False , treats it as plain text.
• listType (Integer, Optional, Default=0) :
- The style of the list.
- 0 : Simple List (No selector)
- 1 : Single Choice List (Radio button on left)
- 2 : Single Choice List (Radio button on right)
- 3 : Multi Choice List (Checkbox on left)
- 4 : Multi Choice List (Checkbox on right)
===== Example of fullSetList =====
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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="45"
android:orientation="horizontal">
<ListView
android:id="@+id/list1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<ListView
android:id="@+id/list2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#003333"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="45"
android:orientation="horizontal">
<ListView
android:id="@+id/list3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#330033"
/>
<ListView
android:id="@+id/list4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#333300"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="10"
android:orientation="horizontal">
<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="1"
/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Change"
android:id="@+id/button_change"
android:textAllCaps="false"
android:gravity="center"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>'''
from androidhelper import Android
droid = Android()
R = droid.R
def showLayout():
droid.fullShow(XML,"Hello QPython",R.style.Theme_Black)
droid.fullSetList('list1', ('item1','item2','item3','item4'))
droid.fullSetList('list2', ('item1','item2','item3','item4'), False, droid.fullSetList.SIMPLE)
droid.fullSetList('list3', ({'msg':'item1','bg':'#00ff00','fg':'#ff00ff'},{'msg':'item2','bg':'#ff0000','fg':'#00ffff'},{'msg':'item3','bg':'#0000ff','fg':'#ffff00'},'item4'), False, droid.fullSetList.SINGLE_CHOICE_LEFT)
droid.fullSetList('list4', ('<font color=#00ff00>item1</font>','<u>item2</u>','<big>item3</big>',{'msg':"item<span style='background-color:#ff0000; color:#0000ff;'><b>4</b></span>",'fg':'#ff00ff','bg':'#ffff00'}), True, droid.fullSetList.MULTI_CHOICE_RIGHT)
Type=['ListView','Spinner']
def printData():
print()
for i in range(1,5):
i=f'list{i}'
print(i)
print('ListSelected',droid.fullGetListSelected(i))
print('MenuPosition',droid.fullGetProperty(i,'selectedItemPosition'))
print()
showLayout()
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':
printData()
print('Now Exit !')
break
elif data_id=='button_change':
XML=XML.replace(*Type)
Type.reverse()
printData()
print('Now Change !')
showLayout()
print()
droid.fullDismiss()
===== ===== ===== =====
fullSetList.SIMPLE = 0
fullSetList.SINGLE_CHOICE_LEFT = 1
fullSetList.SINGLE_CHOICE_RIGHT = 2
fullSetList.MULTI_CHOICE_LEFT = 3
fullSetList.MULTI_CHOICE_RIGHT = 4