麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > OS > 安卓 > 正文

Android使用RecyclerView實現投票系統

2024-09-11 17:15:16
字體:
來源:轉載
供稿:網友

本文實例為大家分享了Android投票系統的具體代碼,供大家參考,具體內容如下

一、創建一個fragment_vote_list.xml用來顯示投票的主頁面

(1)標題欄使用Toolbar
(2)投票區域可以滑動,使用RecyclerView實現

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:andro android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:clickable="true" android:background="@color/backgroundColorWhite"> <LinearLayout  android:layout_width="match_parent"  android:layout_height="match_parent"  android:background="@color/backgroundColorWhite"  android:orientation="vertical">  <android.support.v7.widget.Toolbar   android:   android:layout_width="match_parent"   android:layout_height="@dimen/toolbarHeight"   android:background="@color/backgroundColorWhite"   app:contentInsetStart="0dp">   <RelativeLayout    android:layout_width="match_parent"    android:layout_height="match_parent">    <Button     android:     android:layout_width="@dimen/titleBarBackWidth"     android:layout_height="@dimen/titleBarBackHeight"     android:layout_margin="@dimen/margin_min"     android:layout_centerVertical="true"     android:background="@drawable/titlebar_back"     android:layout_marginLeft="@dimen/padding_20"     />    <TextView     android:     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_centerInParent="true"     android:layout_gravity="center_vertical"     android:text="投票"     android:textColor="@color/textcolor_28282d"     android:textSize="@dimen/textSizeMax"     android:textStyle="bold"/>   </RelativeLayout>  </android.support.v7.widget.Toolbar>  <android.support.v7.widget.RecyclerView   android:   android:layout_width="match_parent"   android:layout_height="match_parent">  </android.support.v7.widget.RecyclerView> </LinearLayout></RelativeLayout>

注:界面字體大小以及控件寬度自行調整即可,使用RecyclerView首先需要在項目的build.gradle中添加相應的依賴庫才行。添加:implementation ‘com.android.support:recyclerview-v7:24.2.1'

界面效果:

二、創建一個item_vote.xml用來顯示投票的具體內容

(1)主布局使用LinearLayout實現,里面添加一個TextView用來顯示投票的問題,使用CheckBox作為投票的多選框。
(2)將當前的Item加載到投票的主頁面中

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:andro android:orientation="vertical"  android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/backgroundColorWhite" > <TextView  android:  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:text="1.請問你支持哪一個決議?"  android:textColor="@color/black"  android:textSize="@dimen/item_vote_question"  android:layout_marginLeft="@dimen/padding_20" /> <LinearLayout  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:background="@color/backgroundColorWhite"  android:orientation="vertical"  android:layout_margin="@dimen/padding_20">  <CheckBox   android:   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="AAAAAA"   android:textColor="@color/black"   android:textSize="@dimen/item_vote_answer" />  <CheckBox   android:   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="BBBBBBB"   android:textColor="@color/black"   android:textSize="@dimen/item_vote_answer" />  <CheckBox   android:   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="BCCCCC"   android:textColor="@color/black"   android:textSize="@dimen/item_vote_answer" /> </LinearLayout> </LinearLayout>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 黄色一级片免费在线观看 | 九九精品在线观看 | 亚洲免费资源 | v11av在线视频成人 | 国产乱子视频 | 免费1级做55爰片l在线观看 | 免费a级毛片永久免费 | 99精品国产小情侣高潮露脸在线 | 国内毛片视频 | 国产精品久久av | 成人国产精品一区二区毛片在线 | 日韩欧美高清片 | 亚洲免费高清 | 日本成年网 | 欧美成人精品欧美一级乱黄 | 欧美999| 国产永久免费观看 | 91真视频 | h视频免费在线 | 情侣啪啪网站 | 黄污在线看 | 蜜桃视频在线播放 | 二区三区四区视频 | 国产在线地址 | 天天操很很操 | 日韩黄色影视 | 久久久久亚洲精品 | av在线免费观看中文字幕 | 欧美一区黄色 | 国产91丝袜在线播放 | 亚洲第一页在线观看 | 色污视频 | 亚州视频在线 | 91av国产在线| 亚洲精品一区中文字幕 | 99re热视频这里只精品 | 伦理三区| 亚洲一区二区在线免费 | 91看片在线播放 | 久久6国产 | 欧美日韩爱爱视频 |