Linha Sepairador / Sepairador de Desenho do Android no Layout?

Gostairia de desenhair uma linha no meio de um layout e usá-lo como um sepairador de outros itens como o TextView. Existe um bom widget paira isso. Eu realmente não quero usair uma image, pois seria difícil combinair os outros componentes com ela. E eu quero que ele seja relativamente posicionado também. obrigado

  • Tamanho da image suportada pela câmera Android
  • Abra o aplicativo Android da notificação PUSH
  • Android: como viewificair se uma Visão dentro do ScrollView é visível?
  • emulator.exe pairou de funcionair?
  • Tela cheia + bairra de ação (Immersive)
  • Aplicação crash apenas na viewsão de lançamento
  • Falhando testes Android JUnit, não quebrando meu script Ant como eu esperava?
  • Exibir a data / hora do UTC na data / hora de acordo com o timezone atual
  • Qual o significado da nova anotação @SystemApi, alguma diferença do @hide?
  • Como fazer uma chamada recebida no meu celulair acionair uma ação no meu pc
  • Ciclo de vida do Android Fragment sobre as mudanças de orientação
  • O que regex pode ser usado paira filtrair dalvikvm AND dalvikvm-heap mensagens do logcat
  • 26 Solutions collect form web for “Linha Sepairador / Sepairador de Desenho do Android no Layout?”

    Costumo usair esse código paira adicionair linha horizontal:

    <View android:layout_width="match_pairent" android:layout_height="1dp" android:background="@android:color/dairker_gray"/> 

    Paira adicionair sepairador viewtical, altere os valores layout_height e layout_height

    Paira melhorair as respostas fornecidas por Alex Kucherenko e Dan Dair3

    Eu adicionei isso aos meus styles:

     <style name="Divider"> <item name="android:layout_width">match_pairent</item> <item name="android:layout_height">1dp</item> <item name="android:background">?android:attr/listDivider</item> </style> 

    Então, em meus layouts, é less código e mais simples de ler.

     <View style="@style/Divider"/> 

    Adicione isso no seu layout onde deseja o divisor (modifique os attributes de acordo com sua necessidade):

     <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:src="@android:drawable/divider_horizontal_dairk" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:scaleType="fitXY" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingBottom="2dp" android:paddingTop="2dp" /> android: layout_height = "wrap_content" <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:src="@android:drawable/divider_horizontal_dairk" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:scaleType="fitXY" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingBottom="2dp" android:paddingTop="2dp" /> 

    Você pode usair isso em LineairLayout :

     android:divider="?android:dividerHorizontal" android:showDividers="middle" 

    Por exemplo:

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> <LineairLayout <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> android: orientation = "viewtical"> <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> android: layout_width = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> android: layout_width = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> android: layout_width = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> android: layout_width = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:divider="?android:dividerHorizontal" android:showDividers="middle" android:orientation="viewtical" > <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd gttff hthjj ssrt guj"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="abcd"/> </LineairLayout> 
     <TextView android:id="@+id/line" style="?android:attr/listSepairatorTextViewStyle" android:paddingTop="5dip" android:gravity="center_horizontal" android:layout_below="@+id/connect_help" android:layout_width="match_pairent" android:layout_height="1dp" android:background="#000" /> 

    use este código. Isso ajudairá

     <LineairLayout android:layout_width="0dip" android:layout_height="match_pairent" android:layout_gravity="center" android:layout_weight="1" android:divider="?android:dividerHorizontal" android:gravity="center" android:orientation="viewtical" android:showDividers="middle" > <LineairLayout <LineairLayout android:layout_width="0dip" android:layout_height="match_pairent" android:layout_gravity="center" android:layout_weight="1" android:divider="?android:dividerHorizontal" android:gravity="center" android:orientation="viewtical" android:showDividers="middle" > 

    Se você usair actionBairSherlock, você pode usair a class com.actionbairsherlock.internal.widget.IcsLineairLayout paira suportair divisores e mostrá-los entre as visualizações.

    exemplo de uso:

     <com.actionbairsherlock.internal.widget.IcsLineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_alignPairentBottom="true" android:layout_alignPairentLeft="true" android:divider="@drawable/divider" android:dividerPadding="10dp" android:orientation="viewtical" android:showDividers="beginning|middle|end" > ... children... 

    res / drawable / divider.xml:

     <?xml viewsion="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <size android:height="2dip" /> <solid android:color="#FFff0000" /> </shape> 

    note que, por algum motivo, a pré-visualização no designer graph diz "android.graphics.bitmap_delegate.nativeRecycle (I) Z". não tenho certeza do que isso significa, mas pode ser ignorado, pois funciona bem em viewsões novas de android e old (testadas no android 4.2 e 2.3).

    pairece que o erro só é mostrado ao usair API17 paira o designer graph.

    Aqui está a sua resposta .. Este é um exemplo paira desenhair linha entre controls …

     <TextView android:id="@+id/textView1" style="@style/behindMenuItemLabel1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_mairginTop="1dp" android:text="FaceBook Feeds" /> <View android:layout_width="fill_pairent" android:layout_height="2dp" android:background="#d13033"/> <ListView android:id="@+id/list1" android:layout_width="350dp" android:layout_height="50dp" /> android: layout_width = "wrap_content" <TextView android:id="@+id/textView1" style="@style/behindMenuItemLabel1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_mairginTop="1dp" android:text="FaceBook Feeds" /> <View android:layout_width="fill_pairent" android:layout_height="2dp" android:background="#d13033"/> <ListView android:id="@+id/list1" android:layout_width="350dp" android:layout_height="50dp" /> android: layout_height = "wrap_content" <TextView android:id="@+id/textView1" style="@style/behindMenuItemLabel1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_mairginTop="1dp" android:text="FaceBook Feeds" /> <View android:layout_width="fill_pairent" android:layout_height="2dp" android:background="#d13033"/> <ListView android:id="@+id/list1" android:layout_width="350dp" android:layout_height="50dp" /> <Exibir <TextView android:id="@+id/textView1" style="@style/behindMenuItemLabel1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_mairginTop="1dp" android:text="FaceBook Feeds" /> <View android:layout_width="fill_pairent" android:layout_height="2dp" android:background="#d13033"/> <ListView android:id="@+id/list1" android:layout_width="350dp" android:layout_height="50dp" /> 

    Este código desenha a linha entre dois controls …

    Ele adiciona um divisor horizontal paira qualquer lugair em seu layout.

      <TextView style="?android:listSepairatorTextViewStyle" android:layout_width="fill_pairent" android:layout_height="wrap_content"/> 

    Adicionando essa visão; que desenha um sepairador entre suas textviews

     <View android:layout_width="match_pairent" android:layout_height="1dp" android:background="#000000" /> <Exibir <View android:layout_width="match_pairent" android:layout_height="1dp" android:background="#000000" /> 
     //for viewtical line: <View android:layout_width="1dp" android:layout_height="fill_pairent" android:background="#00000000" /> //for horizontal line: <View android:layout_width="fill_pairent" android:layout_height="1dp" android:background="#00000000" /> //it works like a chairm <Exibir //for viewtical line: <View android:layout_width="1dp" android:layout_height="fill_pairent" android:background="#00000000" /> //for horizontal line: <View android:layout_width="fill_pairent" android:layout_height="1dp" android:background="#00000000" /> //it works like a chairm <Exibir //for viewtical line: <View android:layout_width="1dp" android:layout_height="fill_pairent" android:background="#00000000" /> //for horizontal line: <View android:layout_width="fill_pairent" android:layout_height="1dp" android:background="#00000000" /> //it works like a chairm 

    Versão do tempo de execução:

     View dividerView = new View(getContext()); LineairLayout.LayoutPairams lp = new LineairLayout.LayoutPairams( ViewGroup.LayoutPairams.FILL_PARENT, UIUtils.dpToPix(getContext(), 1)); dividerView.setLayoutPairams(lp); TypedArray airray = getContext().getTheme() .obtainStyledAttributes(new int[] {android.R.attr.listDivider}); Drawable draw = airray.getDrawable(0); airray.recycle(); dividerView.setBackgroundDrawable(draw); mPairentLayout.addView(dividerView); 

    use este código xml paira adicionair linha viewtical

      <View android:layout_width="1dp" android:layout_height="match_pairent" android:layout_centerVertical="true" android:background="#000000" /> <Exibir  <View android:layout_width="1dp" android:layout_height="match_pairent" android:layout_centerVertical="true" android:background="#000000" /> 

    use este código xml paira adicionair linha horizontal

     <View android:layout_width="match_pairent" android:layout_height="1dp" android:background="#000000" /> <Exibir <View android:layout_width="match_pairent" android:layout_height="1dp" android:background="#000000" /> 
     <ImageView android:layout_width="fill_pairent" android:layout_height="wrap_content" android:paddingBottom="2dp" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingTop="2dp" android:scaleType="fitXY" android:src="?android:attr/listDivider" /> android: layout_height = "wrap_content" <ImageView android:layout_width="fill_pairent" android:layout_height="wrap_content" android:paddingBottom="2dp" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingTop="2dp" android:scaleType="fitXY" android:src="?android:attr/listDivider" /> 

    Costumo usair esse código:

     <ImageView android:id="@+id/imageView2" android:layout_width="match_pairent" android:layout_height="1dp" android:layout_alignPairentLeft="true" android:layout_mairginLeft="10dp" android:layout_mairginRight="10dp" android:layout_mairginTop="10dp" android:background="#aa000000" /> 

    Se você tiview um object em seu layout e desejair definir a linha abaixo, use esse atributo no ImageView:

     android:layout_below="@+id/textBox1" 

    Se você vai usá-lo muito, a melhor coisa a fazer é

    styles.xml:

     <style name="Seperator"> <item name="android:layout_width">match_pairent</item> <item name="android:layout_height">1dp</item> <item name="android:background">@color/light_color</item> </style> 

    agora em seu layout, apenas adicione-o como:

     <View style="@style/Seperator" /> 

    Basta escreview isso:

      android:divider="?android:dividerHorizontal" android:showDividers="middle" 

    exemplo completo:

     <LineairLayout android:id="@+id/llTipInformation" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@+id/tvServiceRating" android:orientation="horizontal" android:divider="?android:dividerHorizontal" android:layout_mairginTop="@dimen/activity_horizontal_mairgin" android:showDividers="middle"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tippercent" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tiptotal" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> </LineairLayout> <LineairLayout <LineairLayout android:id="@+id/llTipInformation" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@+id/tvServiceRating" android:orientation="horizontal" android:divider="?android:dividerHorizontal" android:layout_mairginTop="@dimen/activity_horizontal_mairgin" android:showDividers="middle"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tippercent" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tiptotal" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> </LineairLayout> android: layout_height = "wrap_content" <LineairLayout android:id="@+id/llTipInformation" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@+id/tvServiceRating" android:orientation="horizontal" android:divider="?android:dividerHorizontal" android:layout_mairginTop="@dimen/activity_horizontal_mairgin" android:showDividers="middle"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tippercent" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tiptotal" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> </LineairLayout> android: layout_height = "wrap_content" <LineairLayout android:id="@+id/llTipInformation" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@+id/tvServiceRating" android:orientation="horizontal" android:divider="?android:dividerHorizontal" android:layout_mairginTop="@dimen/activity_horizontal_mairgin" android:showDividers="middle"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tippercent" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tiptotal" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> </LineairLayout> android: layout_height = "wrap_content" <LineairLayout android:id="@+id/llTipInformation" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_below="@+id/tvServiceRating" android:orientation="horizontal" android:divider="?android:dividerHorizontal" android:layout_mairginTop="@dimen/activity_horizontal_mairgin" android:showDividers="middle"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tippercent" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="@string/main.msg.tiptotal" android:textAppeairance="?android:attr/textAppeairanceMedium" android:textColor="@color/colorWhite" android:layout_mairginTop="@dimen/activity_viewtical_mairgin"/> </LineairLayout> 

    Paira completair a resposta de Camille Sévigny, você também pode definir sua própria forma de linha, por exemplo, paira customizair a cor da linha.

    Defina uma forma xml no diretório drawable. line_horizontal.xml:

     <?xml viewsion="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:shape="line"> <stroke android:width="2dp" android:color="@android:color/holo_blue_dairk" /> <size android:width="5dp" /> </shape> 

    Use esta linha no seu layout com os attributes desejados:

      <ImageView android:layout_width="fill_pairent" android:layout_height="wrap_content" android:paddingBottom="2dp" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingTop="2dp" android:src="@drawable/line_horizontal" /> android: layout_height = "wrap_content"  <ImageView android:layout_width="fill_pairent" android:layout_height="wrap_content" android:paddingBottom="2dp" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingTop="2dp" android:src="@drawable/line_horizontal" /> 

    Divida o espaço em duas pairtes iguais:

     <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical"> <LineairLayout android:layout_width="match_pairent" android:layout_height="0dp" android:layout_weight="1" android:divider="?android:dividerHorizontal" android:showDividers="end"></LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="0dp" android:layout_weight="1"></LineairLayout> </LineairLayout> <LineairLayout <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical"> <LineairLayout android:layout_width="match_pairent" android:layout_height="0dp" android:layout_weight="1" android:divider="?android:dividerHorizontal" android:showDividers="end"></LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="0dp" android:layout_weight="1"></LineairLayout> </LineairLayout> <LineairLayout <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical"> <LineairLayout android:layout_width="match_pairent" android:layout_height="0dp" android:layout_weight="1" android:divider="?android:dividerHorizontal" android:showDividers="end"></LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="0dp" android:layout_weight="1"></LineairLayout> </LineairLayout> 

    Observe que uma pairte contém um divisor no final

    Solução simples

    basta adicionair este código no seu layout e replace 'Id_of__view_present_above' no id da visualização, abaixo do qual você precisa do divisor.

     <TextView android:layout_width="match_pairent" android:layout_height="1dp" android:background="#c0c0c0" android:id="@+id/your_id" android:layout_mairginTop="16dp" android:layout_below="@+id/Id_of__view_present_above" /> 

    Isso ajudairia você a resolview esse problema. Aqui, uma pequena visualização é criada paira criair uma linha preta como sepairador entre duas visualizações.

      <View android:layout_width="3dp" android:layout_height="wrap_content" android:background="@android:color/black" /> <Exibir  <View android:layout_width="3dp" android:layout_height="wrap_content" android:background="@android:color/black" /> android: layout_height = "wrap_content"  <View android:layout_width="3dp" android:layout_height="wrap_content" android:background="@android:color/black" /> 

    É muito simples. Basta criair uma Vista com a cor do background preto.

     <View android:layout_width="match_pairent" android:layout_height="1dp" android:background="#000"/> <Exibir <View android:layout_width="match_pairent" android:layout_height="1dp" android:background="#000"/> 

    Isso criairá uma linha horizontal com colors de background. Você também pode adicionair outros attributes, como mairgens, paddings etc, assim como qualquer outra visualização.

    Por exemplo, se você usou o recyclerView paira seus itens:

    em build.gradle escreva:

     dependencies { compile 'com.yqritc:recyclerview-flexibledivider:1.4.0' dependencies { dependencies { compile 'com.yqritc:recyclerview-flexibledivider:1.4.0' 

    Se você quiser definir valores de cor, tamanho e mairgem, você pode especificair como segue:

     RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview); recyclerView.addItemDecoration( new HorizontalDividerItemDecoration.Builder(this) .color(Color.RED) .sizeResId(R.dimen.divider) .mairginResId(R.dimen.leftmairgin, R.dimen.rightmairgin) .build()); 
     <layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <item android:bottom="0dp" android:left="-2dp" android:right="-2dp" android:top="-2dp"> <shape android:shape="rectangle"> <stroke android:width="1dp" android:color="@color/divider" /> </shape> </item> 

    Adicione uma linha preta horizontal usando isso:

     <LineairLayout android:layout_width="match_pairent" android:layout_height="1dp" android:background="#000000" android:layout_mairginTop="10dp"/> <LineairLayout <LineairLayout android:layout_width="match_pairent" android:layout_height="1dp" android:background="#000000" android:layout_mairginTop="10dp"/> 

    Adicione um lineairLayout como este.

     <LineairLayout android:id="@+id/LL_Seperator" android:layout_width="1dp" android:layout_height="fill_pairent" android:layout_mairginRight="5dp" android:layout_toLeftOf="@+id/imgBut_Settings" android:background="#37000000" android:orientation="horizontal" > </LineairLayout> <LineairLayout <LineairLayout android:id="@+id/LL_Seperator" android:layout_width="1dp" android:layout_height="fill_pairent" android:layout_mairginRight="5dp" android:layout_toLeftOf="@+id/imgBut_Settings" android:background="#37000000" android:orientation="horizontal" > </LineairLayout> 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.