[Android SDK] The most elegant separator

According to this SO question, and the solutions given by toddles_fp, Dan Dar3, Alex Kucherenko, the simplest and most re-usable separator is this one:

styles.xml

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

activity_main.xml

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

Thanks to the authors for their job. I just post this shortcut for using it in the future, and for other developers looking for the same! :-)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s