這篇文章將為大家詳細(xì)講解有關(guān)Android中滑動(dòng)數(shù)值選擇器NumberPicker的用法分析,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
簡(jiǎn)介:
NumberPicker: 用戶既可以從鍵盤(pán)輸值,也可以拖動(dòng)來(lái)選擇值
實(shí)際效果:
常用方法:
1. setMinValue()
設(shè)置組件支持的最小值
2. setMaxValue()
設(shè)置組建支持的大值
3. setValue()
設(shè)置該組件的當(dāng)前值
在布局文件中調(diào)用:
<?xml version="1.0" encoding="utf-8" ?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TableRow android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="vertical"> <TextView android:text="選擇時(shí)鐘" android:textSize="20dp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <NumberPicker android:id="@+id/np1" android:solidColor="@color/colorPrimaryDark" android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true"/> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="vertical"> <TextView android:text="選擇分鐘" android:textSize="20dp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <NumberPicker android:id="@+id/np2" android:solidColor="@color/colorAccent" android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true" /> </TableRow> </TableLayout>
當(dāng)前標(biāo)題:Android中滑動(dòng)數(shù)值選擇器NumberPicker的用法分析-創(chuàng)新互聯(lián)
文章網(wǎng)址:http://www.rwnh.cn/article36/dghjsg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站導(dǎo)航、網(wǎng)站維護(hù)、網(wǎng)站策劃、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容