ListView touch mode click on child views

by Xavier » Sat, 16 Jan 2010 02:07:16 GMT


Sponsored Links
 Hello,

This is driving me nuts. I have a ListView that uses an extended
ArrayAdapter<T>. Each row "cell.xml" contains a RelativeLayout and
within a few TextViews and ImageViews.

I have declared in the list xml definition a selector to change the
row background:

<item name="android:listSelector">@drawable/list_selector_background</
item>

It works. But only if the click (touch mode) not done over any of the
elements contained in the RelativeLayout. Any click outside this
elements will (correctly) trigger the selector. I have tried using
android:focusable="false" on each child view without avail.

What do I need to do to be able to trigger the selector, no matter
where the user clicks?

Thanks!



ListView touch mode click on child views

by Zsolt Vasvari » Sat, 16 Jan 2010 09:07:06 GMT


 Have you tried setting focusable="true" on the entire View the makes
up the list item?



> Thanks!


Sponsored Links


Other Threads

1. Aplikasi ghost radar

bini=bukan istri namun intim

syd
ptk

------- Original message -------
From: Rivelino Nugraha <r...@id-gtf.com> Sender: id-android@googlegroups.com Date: Thu, 25 Nov 2010 08:10:36 +0800 To: <id-android@googlegroups.com> ReplyTo: id-android@googlegroups.com Subject: Re: [id-android] Aplikasi ghost radar Dulu gw pernah nyoba jam 1 malem, sambil gw tanya, siapa nama bini gw... Dilayar ghost radar muncul nama panggilan bini gw Beughhhh....langsung merinding
-- =============== "

2. and it's Google Map again

I don't know what i always seem to end up doing wrong but it is quite
irritating now and
it is second time i am posting on same topic.
Please if anyone can take time to read the following code and guide me
that what is lacking i would be highly obliged

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="org.mymapinapi"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
      <uses-library android:name="com.google.android.maps" />
        <activity android:name=".mymapinapi"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
    </application>
    <uses-sdk android:minSdkVersion="7" />

</manifest>


                                             Main.xml :-
The layout contains two linear layouts.
The first one has 5 buttons in horizontal layout and second one has
simple mapview wih google api

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <Button android:id="@+id/zoomin"
            android:text="+"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    <Button android:id="@+id/zoomout"
            android:text="-"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    <Button android:id="@+id/satellite"
            android:text="Satellite"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    <Button android:id="@+id/street"
            android:text="Street"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    <Button android:id="@+id/traffic"
            android:text="Traffic"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />


</LinearLayout>

<LinearLayout android:id="@+id/LinearLayout01"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content">
              <com.google.android.maps.MapView android:id="@+id/mymap"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
 
android:apiKey="033PkWkCKskK50UfVjdjehD71XJ55xuDOEassDQ" /></
LinearLayout>


</LinearLayout>


                                                          Main Java
file :-

package org.mymapinapi;


import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class mymapinapi extends MapActivity {
        MapView mv;
        Button btn1,btn2,btn3,btn4,btn5;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    mv=(MapView)findViewById(R.id.mymap);
    btn1=(Button)findViewById(R.id.zoomin);
    btn2=(Button)findViewById(R.id.zoomout);
    btn3=(Button)findViewById(R.id.satellite);
    btn4=(Button)findViewById(R.id.street);
    btn5=(Button)findViewById(R.id.traffic);

    btn1.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.getController().zoomIn();

                }

    });

    btn2.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.getController().zoomOut();

                }

    });

    btn3.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.setStreetView(false);
                        mv.setTraffic(false);
                        mv.setSatellite(true);

                }

    });

    btn4.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.setStreetView(true);
                        mv.setTraffic(false);
                        mv.setSatellite(false);

                }

    });

    btn5.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.setStreetView(false);
                        mv.setTraffic(true);
                        mv.setSatellite(false);

                }

    });
    }

        @Override
        protected boolean isRouteDisplayed() {
                // TODO Auto-generated method stub
                return false;
        }
}

-- 

3. sgs camera problem DXJPA

4. Can we Import contacts in List Preferences

5. Help - Gecoding is failing on a regular basis - does anyone else notice this?

6. Getting UnsupportedOperationException when inserting a contact from third party appliaction!!!

7. skype apps