Transparent/dim ListView background - I want to destroy ListView activity when clicking on background
<p>I have a <code>ListView</code> list that operates nicely. It's set this way:</p>

<pre><code>&lt;style name="Theme.Transparent" parent="android:Theme"&gt; 
    &lt;item name="android:windowIsTranslucent"&gt;true &lt;/item&gt;
    &lt;item name="android:windowBackground"&gt;@android:color/transparent&lt;/item&gt;
    &lt;item name="android:windowContentOverlay"&gt;@null&lt;/item&gt;
    &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt;
    &lt;item name="android:windowIsFloating"&gt;true&lt;/item&gt;
    &lt;item name="android:backgroundDimEnabled"&gt;true&lt;/item&gt;
&lt;/style&gt;
</code></pre>

<p>This is my xml file:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:padding="0dp" 
   android:background="@drawable/button_pressed"
   android:clickable="false"
   android:id="@+id/ListViewLayout" &gt;

    &lt;ImageView
        android:id="@+id/logo"
        android:layout_width="100dp"
        android:layout_height="50dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="5dp" /&gt;

    &lt;TextView
        android:id="@+id/label"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="30dp" &gt;
    &lt;/TextView&gt;
&lt;/LinearLayout&gt; 
</code></pre>

<p>I also have a block of code which creates my <code>ListView</code> and handles my clicks:</p>

<pre><code>public class RandomList extends ListActivity {
    static final String[] randomList = new String[] {"Name 1", "Name 2", "Name 3", "Logo"};

    @Override
    public void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setListAdapter(new RandomArrayAdapter(this, randomList));
    }

    protected void onListItemClick(ListView l, View v, int position, long id){
        //Get selected items
        Log.v("ListView l:", l.toString());
        Log.v("View v:", v.toString());
        Log.v("Position:", ""+position);
        Log.v("ID: ", ""+id);
        String selectedValue = (String) getListAdapter().getItem(position);
        Bundle bundle = new Bundle();
        bundle.putString("Name", selectedValue);
        Intent mIntent = new Intent();
        mIntent.putExtras(bundle);
        setResult(RESULT_OK, mIntent);
        finish();
    }
}
</code></pre>

<p>Now, with the <code>ArrayAdapter</code> et al, what happens is I get a list of items. As there are only five items, and due to the style I set for it, most of the screen is dimmed out (the original <code>Activity</code>), and only the list is centred. The problem is, I want to finish the <code>Activity</code> should someone click on the gray region outside of the list box. I cannot for the life of me figure out how.</p>

<p>I tried to implement an <code>OnTouchListener</code>, but <code>ListView</code> isn't letting me do so and I can't figure out how to call it for the <code>LinearLayout</code> container that surrounds the <code>TextView</code>. I'm fairly new to Android, so please dumb it down for me.</p>
