方法一也是我們常用的方法,可以在按鈕間添加作為分割線的View,設(shè)定好View的寬度高度和顏色值后插入按鈕的布局間。
成都創(chuàng)新互聯(lián)是專業(yè)的磐安網(wǎng)站建設(shè)公司,磐安接單;提供成都網(wǎng)站制作、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè),網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行磐安網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊,希望更多企業(yè)前來合作!
View的樣式如下:
View
android:layout_height="fill_parent"
android:layout_width="1dp"
android:background="#90909090"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
/
相應(yīng)的布局如下:
LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:orientation="horizontal"
Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="Yes"
android:layout_weight="1"
android:id="@+id/button1"
android:textColor="#00b0e4" /
View android:layout_height="fill_parent"
android:layout_width="1px"
android:background="#90909090"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:id="@+id/separator1" /
Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="No"
android:layout_weight="1"
android:id="@+id/button2"
android:textColor="#00b0e4" /
View android:layout_height="fill_parent"
android:layout_width="1px"
android:background="#90909090"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:id="@+id/separator2" /
Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="Neutral"
android:layout_weight="1"
android:id="@+id/button3"
android:textColor="#00b0e4" //LinearLayout
方法二
通過LinearLayout指定的divider的屬性來插入分隔符,類似于Listview的效果。這種方法的好處在于縮減布局代碼量,同時在button數(shù)量未知的情況下能更方便的進(jìn)行顯示。但是這種方法只適用API版本11以上的機(jī)型。
使用方法也很簡單,先創(chuàng)建分隔線的樣式文件
?xml version="1.0" encoding="utf-8"?shape xmlns:android=""
size android:width="1dp" /
solid android:color="#90909090" //shape
再在布局文件中引用
LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:divider="@drawable/separator"
android:showDividers="middle"
android:orientation="horizontal"
Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="Yes"
android:layout_weight="1"
android:id="@+id/button1"
android:textColor="#00b0e4" /
Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="No"
android:layout_weight="1"
android:id="@+id/button2"
android:textColor="#00b0e4" /
Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="Neutral"
android:layout_weight="1"
android:id="@+id/button3"
android:textColor="#00b0e4" //LinearLayout
最主要的代碼如下
android:divider="@drawable/separator"
android:showDividers="middle"
當(dāng)然分隔線的樣式也可以用圖片來替代,這就看項目的需求了。
1
在Android應(yīng)用中運(yùn)行的分割字符串不能寫成split(“|”);
2
split(“|”);得出的結(jié)果
3
在Android應(yīng)用中運(yùn)行的分割字符串不能寫成split(“[ | ]”);得為字符串加上綜括號。
4
split(“[ | ]”);得出的結(jié)果
5
總結(jié),使用字符分割的代碼如果是在JDK的環(huán)境中運(yùn)行就是用split(“|”);如果是在Android運(yùn)行環(huán)境中的話酒的使用split(“[ | ]”);
方法一
也是我們常用的方法,可以在按鈕間添加作為分割線的View,設(shè)定好View的寬度高度和顏色值后插入按鈕的布局間。
View的樣式如下:
android:layout_height="fill_parent"
android:layout_width="1dp"
android:background="#90909090"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
/
方法二
通過LinearLayout指定的divider的屬性來插入分隔符,類似于Listview的效果。這種方法的好處在于縮減布局代碼量,同時在button數(shù)量未知的情況下能更方便的進(jìn)行顯示。但是這種方法只適用API版本11以上的機(jī)型。
使用方法也很簡單,先創(chuàng)建分隔線的樣式文件
?xml version="1.0" encoding="utf-8?
shape xmlns:android=""
size android:width="1dp"
solid android:color="#90909090"http://shape
再在布局文件中引用
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:divider="@drawable/separator"
android:showDividers ="middle|end|beginning|none"
android:orientation="horizontal"
分隔線的樣式也可以用圖片來替代,這就看項目的需求了
作者:風(fēng)趣美文
鏈接:
來源:簡書
著作權(quán)歸作者所有。商業(yè)轉(zhuǎn)載請聯(lián)系作者獲得授權(quán),非商業(yè)轉(zhuǎn)載請注明出處。
%
function irs(num,pic)
temp = split(pic,"|")
response.write temp(num)
end function
%
可能你是這意思,如果想函數(shù)調(diào)用直接顯示圖片的話,把
response.write temp(num)改成
response.write "img src="temp(num)""就行了.
調(diào)用時
%=irs(2,rs("pic")%
這樣是你固定調(diào)用某張圖,,如果要全部循環(huán)調(diào)用的話,就不用這樣了,直接循環(huán)全部就行了.
但是感覺沒必要這么麻煩,不過或許在你的程序里有另外的結(jié)構(gòu)..
android studio設(shè)置分割線的話,在xml布局文件里面,你可以使用view,這是寬度或者高度為1px就行。
網(wǎng)站欄目:android分割,android手機(jī)怎么分屏
網(wǎng)頁鏈接:http://vcdvsql.cn/article26/dsdiocg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、面包屑導(dǎo)航、搜索引擎優(yōu)化、全網(wǎng)營銷推廣、品牌網(wǎng)站設(shè)計、做網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)