SwipeRefreshLayout¶
Example¶
from enamlnative.core.api import *
from enamlnative.widgets.api import *
enamldef ContentView(Flexbox): view:
flex_direction = "column"
attr httpclient = AsyncHttpClient()
attr request
SwipeRefreshLayout:
trigger_distance = 10
indicator_color = "#0F0"
indicator_background_color = "#EEE"
refreshed::
f = httpclient.fetch(http_url.text)
view.request = f.request
ScrollView:
Flexbox:
flex_direction = "column"
EditText: http_url:
text = "http://worldclockapi.com/api/json/est/now"
TextView:
text = "Swipe to refresh"
Conditional:
condition << request is not None
ProgressBar:
progress << request.response.progress
TextView:
text << "Status: {} Reason: ".format(
request.response.code,
request.response.reason,
)
Conditional:
condition << request.response.ok
TextView:
text << "{}".format(request.response.body)
Declaration¶
- class enamlnative.widgets.swipe_refresh_layout.SwipeRefreshLayout(parent=None, **kwargs)[source]¶
Bases:
enamlnative.widgets.view_group.ViewGroup
SwipeRefreshLayout is a view group that displays child views in relative positions.
- enabled¶
Enabled
- indicator_color¶
Must be a
- indicator_background_color¶
Must be a
- trigger_distance¶
Set the distance to trigger a sync in dips
- refreshed¶
Triggered when the user swipes
- proxy¶
A reference to the proxy object.
Android Implementation¶
- class enamlnative.android.android_swipe_refresh_layout.AndroidSwipeRefreshLayout[source]¶
Bases:
enamlnative.android.android_view_group.AndroidViewGroup
,enamlnative.widgets.swipe_refresh_layout.ProxySwipeRefreshLayout
An Android implementation of an Enaml ProxySwipeRefreshLayout.
- widget¶
A reference to the widget created by the proxy.
No iOS implementation found.