Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the separator line in the spinner?

How to remove the separator line in the spinner?

For example, how can I remove/control these white separator lines?

spinner

P.S. This is the row layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/black">

    <TextView
    android:id="@+id/catalog_spinner_item_textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="11dp"
    android:text="@string/CatalogSpinnerItemRowDefaultText"
    android:textSize="18sp"
    android:gravity="center_vertical"/>
</LinearLayout>
like image 886
David Avatar asked Apr 08 '13 12:04

David


1 Answers

public View getView(int position, View row, ViewGroup container) {
    row=(View) inflater.inflate(R.layout.row_layout_spinner_filter, null);
    TextView tv=(TextView) row.findViewById(R.id.textview_spinner_filter_item_name);
    if(container!=null&&(container instanceof ListView)){
        ListView lv=null;
        try{
            lv=(ListView)container;
        }catch(Exception e){}
        if(lv!=null){
            lv.setDivider(drawable);
            lv.setDividerHeight(height);
        }
    }
    tv.setText(getItem(position));
    return row;
}

ViewGroup container comes as ListView or Spinner, so you can catch listview and edit divider.

like image 62
amadeus Avatar answered Nov 15 '22 01:11

amadeus