方法一也是我們常用的方法,可以在按鈕間添加作為分割線的View,設定好View的寬度高度和顏色值后插入按鈕的布局間。
成都創(chuàng)新互聯(lián)是專業(yè)的磐安網站建設公司,磐安接單;提供成都網站制作、網站建設、外貿網站建設,網頁設計,網站設計,建網站,PHP網站建設等專業(yè)做網站服務;采用PHP框架,可快速的進行磐安網站開發(fā)網頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網站,專業(yè)的做網站團隊,希望更多企業(yè)前來合作!
View的樣式如下:
View
android:layout_height="fill_parent"
android:layout_width="1dp"
android:background="#90909090"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
/
相應的布局如下:
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數量未知的情況下能更方便的進行顯示。但是這種方法只適用API版本11以上的機型。
使用方法也很簡單,先創(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"
當然分隔線的樣式也可以用圖片來替代,這就看項目的需求了。
1
在Android應用中運行的分割字符串不能寫成split(“|”);
2
split(“|”);得出的結果
3
在Android應用中運行的分割字符串不能寫成split(“[ | ]”);得為字符串加上綜括號。
4
split(“[ | ]”);得出的結果
5
總結,使用字符分割的代碼如果是在JDK的環(huán)境中運行就是用split(“|”);如果是在Android運行環(huán)境中的話酒的使用split(“[ | ]”);
方法一
也是我們常用的方法,可以在按鈕間添加作為分割線的View,設定好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數量未知的情況下能更方便的進行顯示。但是這種方法只適用API版本11以上的機型。
使用方法也很簡單,先創(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"
分隔線的樣式也可以用圖片來替代,這就看項目的需求了
作者:風趣美文
鏈接:
來源:簡書
著作權歸作者所有。商業(yè)轉載請聯(lián)系作者獲得授權,非商業(yè)轉載請注明出處。
%
function irs(num,pic)
temp = split(pic,"|")
response.write temp(num)
end function
%
可能你是這意思,如果想函數調用直接顯示圖片的話,把
response.write temp(num)改成
response.write "img src="temp(num)""就行了.
調用時
%=irs(2,rs("pic")%
這樣是你固定調用某張圖,,如果要全部循環(huán)調用的話,就不用這樣了,直接循環(huán)全部就行了.
但是感覺沒必要這么麻煩,不過或許在你的程序里有另外的結構..
android studio設置分割線的話,在xml布局文件里面,你可以使用view,這是寬度或者高度為1px就行。
網站欄目:android分割,android手機怎么分屏
網頁鏈接:http://chinadenli.net/article26/dsdiocg.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供虛擬主機、面包屑導航、搜索引擎優(yōu)化、全網營銷推廣、品牌網站設計、做網站
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)