clean Item Selection - Android android.view

Android examples for android.view:View

Description

clean Item Selection

Demo Code


import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
import android.support.v4.widget.SlidingPaneLayout;
import android.view.View;
import android.widget.ListView;

public class Main{

    public static void cleanItemSelection(View item) {
        int sdk = android.os.Build.VERSION.SDK_INT;
        if (item != null) {
            item.setSelected(false);//from  w  ww . j a  va2  s .  co m
            if (sdk >= Build.VERSION_CODES.HONEYCOMB) {
                deactivate(item);

            }
            item.setFocusable(false);
        }

    }
    private static void deactivate(View item) {
        item.setActivated(false);
    }

}

Related Tutorials