> For the complete documentation index, see [llms.txt](https://ricardev.gitbook.io/apuntes-android/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ricardev.gitbook.io/apuntes-android/escribiendo-tu-primera-app/paradigmas-de-diseno/views/pallete-widgets/divider.md).

# Divider

{% embed url="<https://developer.android.com/reference/com/google/android/material/divider/MaterialDivider>" %}
Fuente: developer.android
{% endembed %}

{% embed url="<https://m2.material.io/components/dividers>" %}
Fuente: material design
{% endembed %}

## DEFINICIÓN

Un `divider` es un `View` normal y corriente con unas características concretas que lo definen como `divider`.&#x20;

En la actualidad, se utilizan los `MaterialDividers` en vez de los `Dividers` normales pero en la Pallete Widgets el que aparece es el normal.

Existen dos tipos:

* **Divider Horizontal**
* **Divider Vertical**

## USO DESDE XML

{% code title="activity\_main.xml" %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_margin="15dp">

        <View
            android:id="@+id/divider"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="?android:attr/listDivider" />
        <View
            android:id="@+id/divider2"
            android:layout_width="5dp"
            android:layout_height="260dp"
            android:background="?android:attr/listDivider" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="PRUEBA 1"/>
        <View
            android:id="@+id/divider3"
            android:layout_width="5dp"
            android:layout_height="260dp"
            android:background="?android:attr/listDivider" />
        <View
            android:id="@+id/divider4"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="?android:attr/listDivider" />
    </LinearLayout>
</ScrollView>
```

{% endcode %}

&#x20;                                         ![](/files/QIeEEB8NONpkuvKnfDFQ)

{% hint style="info" %}
Para saber más vea los enlaces de la parte superior de la página.
{% endhint %}
