Android custom control drop-down refresh instance code
•
Android
Effect achieved:
Picture material:
-->First, write the pull-down refresh layout during refresh_ to_ refresh.xml:
<resources> <string name="app_name">PullToRefreshTest</string> <string name="pull_to_refresh">下拉可以刷新</string> <string name="release_to_refresh">释放立即刷新</string> <string name="refreshing">正在刷新...</string> <string name="not_updated_yet">暂未更新过</string> <string name="updated_at">上次更新于%1$s前</string> <string name="updated_just_Now">刚刚更新</string> <string name="time_error">时间有问题</string> </resources> <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pull_to_refresh_head" android:layout_width="match_parent" android:layout_height="60dp"> <LinearLayout android:layout_width="200dp" android:layout_height="60dp" android:layout_centerInParent="true" android:orientation="horizontal"> <RelativeLayout android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="3"> <ImageView android:id="@+id/arrow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:src="@mipmap/indicator_arrow" /> <ProgressBar android:id="@+id/progress_bar" android:layout_width="30dp" android:layout_height="30dp" android:layout_centerInParent="true" android:visibility="gone" /> </RelativeLayout> <LinearLayout android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="12" android:orientation="vertical"> <TextView android:id="@+id/description" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_horizontal|bottom" android:text="@string/pull_to_refresh" /> <TextView android:id="@+id/updated_at" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_horizontal|top" android:text="@string/updated_at" /> </LinearLayout> </LinearLayout> </RelativeLayout>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码