How to make listview divider line display more bold by increasing its height.
By changing listView divider line height app developer can make divider looks more strong like into bold format. Because some times on the larger tablet devices or TV’s small and thin line doesn’t look pretty much cool so it can be modify through android:dividerHeight=”3dp” attribute inside ListView widget. So here is the complete step by step tutorial for Change listview divider line height in android.
How to Change listview divider line height in android.
Code for MainActivity.java file.
package com.listviewseparatorlineheight_android_examples.com; import android.app.Activity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends Activity { ListView listViewLineHeight ; String[] listviewValue = new String[] {"1", "2", "3", "4", "5", "6"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listViewLineHeight = (ListView)findViewById(R.id.listView1); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_2, android.R.id.text1, listviewValue); listViewLineHeight.setAdapter(adapter); } }
Code for activity_main.xml layout file.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.listviewseparatorlineheight_android_examples.com.MainActivity" >
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:dividerHeight="5dp"
android:divider="#00f4fd" >
</ListView>
</RelativeLayout>