十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
可以用下面幾種方法
成都創(chuàng)新互聯(lián)公司擁有網(wǎng)站維護技術和項目管理團隊,建立的售前、實施和售后服務體系,為客戶提供定制化的網(wǎng)站設計制作、做網(wǎng)站、網(wǎng)站維護、成都聯(lián)通服務器托管解決方案。為客戶網(wǎng)站安全和日常運維提供整體管家式外包優(yōu)質服務。我們的網(wǎng)站維護服務覆蓋集團企業(yè)、上市公司、外企網(wǎng)站、商城網(wǎng)站建設、政府網(wǎng)站等各類型客戶群體,為全球超過千家企業(yè)提供全方位網(wǎng)站維護、服務器維護解決方案。
1,設置android:divider="@null"也即不為listview設置分割線
2,設置android:divider="@android:color/transparent"就是分割線透明,相當于沒有分割線,不過分割線還是會占一些位置
3,設置android:dividerHeight="0dp"設置分割線高度為0,也就沒有分割線了
方法一
也是我們常用的方法,可以在按鈕間添加作為分割線的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數(shù)量未知的情況下能更方便的進行顯示。但是這種方法只適用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è)轉載請注明出處。
方法一也是我們常用的方法,可以在按鈕間添加作為分割線的View,設定好View的寬度高度和顏色值后插入按鈕的布局間。
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數(shù)量未知的情況下能更方便的進行顯示。但是這種方法只適用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"
當然分隔線的樣式也可以用圖片來替代,這就看項目的需求了。