Android :: How To Make Listview With Selectable Children Stop Scrolling On Touch Event

Oct 20, 2009

As a work around to the issue where a list item isn't focusable if it has a focusable child item (a comment by Romain Guy was that this was intended behavior, for accessibility reasons) I simply filled the listItem with two children, each of which is focusable - There's nowhere to directly touch on the listItem anymore, just it's children.

For the most part this is a useable workaround, effectively invisible to the user, except for one thing- Although you can scroll by swiping without issue, touching to *stop* the scroll no longer works- I imagine because the child item is capturing the touch event and not passing it to the parent listitem, at least while the scroll is in effect.

Is there a known workaround for this? Perhaps someway to "pass the baton" of the touch event back up to the parent listItem, or a way to change my design?

BTW- I know there's some built-in functonality for single/multiple choice listviews (checkbox listviews) - That doesn't actually help in my case. The app is a contact list, and the row children are a relativelayout (populated with contact info) and a clickable phone icon (a one-touch dial for the contact), which needs to be visible or invisible depending on whether the stored contact has a phone number.

Android :: How to make listview with selectable children stop scrolling on touch event


Android :: How To Make Children Of Selectable Table Row

Sep 23, 2010

I'm making a image gallery with infinite vertical and horizontal scrolling. I put images inside a ListView to make a column, and put the ListViews inside a TableRow. However, it seems that child views of TableRow is not selectable and as a result I can't select the images in my ListView (easily). Is there a way to pass the events down to child views of TableRow so they can be selectable?

View 2 Replies View Related

Android :: How To Make Children Of Selectable TableRow

Sep 23, 2010

I'm making a image gallery with infinite vertical and horizontal scrolling. I put images inside a ListView to make a column, and put the ListViews inside a TableRow. However, it seems that child views of TableRow is not selectable and as a result I can't select the images in my ListView (easily). Is there a way to pass the events down to child views of TableRow so they can be selectable?

View 1 Replies View Related

Android :: Stop Scrolling ListView?

Aug 5, 2010

I have a scenario, where I have three buttons(like tabs) and when clicking on each button, I am showing a listView, such that, I select one button and scroll the listView. During scrolling if I click on any other button, that list is also continue scrolling. Actually, I don't want the scrolling

When I click on any other button, it should not scroll and it should be in the starting position(means index 0).

I tried onScrollChangeListener(), in that onScrollStateChanged() is there.

I tried putting setSelection(0) in SCROLL_STATE_FLING & SCROLL_STATE_SCROLL state.

Its going to index zero, but continue from there, its still scrolling. How can I stop this scrolling.

View 2 Replies View Related

Android : How To Disable Touch Event On ListView

Oct 29, 2009

I have a ListView with a setOnItemClickListener. I am trying to prevent the user from pressing an item repeatedly but can't seem to get it to work. I have tried the following. Code...

View 3 Replies View Related

Android :: Touch Or Click Event With ListView Containing GridView

Nov 10, 2009

Here is my problem : I have a view containing a listView. And each row of this listview is composed of a linearLayout, itself composed of three textview and a gridView. Here is a summary of my layout for one row:

......

I want to perform an action when the user click anywere on an item of the listview. So I try these two approaches on the listview : - myActivity.getListView().setOnTouchListener(new View.OnTouchListener () {...}) - myActivity.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { ...}) And here is the trouble : - when I click on the textview, it nearly works : the touch listener is called, but not the clicklistener - when I click on the gridView it doesn't work....the event is just dispatched to the element of the gridView.............

View 4 Replies View Related

Android :: Make ListView Scrollbar Expand Whilst Scrolling?

May 13, 2009

I'm having a little problem with a ListView scrollbar. The scrollbar appears at the side as expected, but how do I get the scrollbar to expand and become controllable in the same way it behaves in the Contact list? Ideally I'd like all the Contacts list functionality for my app - i.e. to allow me to control the scrollbar directly with a finger and to show the first letter of the list elements you're currently scrolled to.

View 6 Replies View Related

Android :: Code To Create On Click Event For Children In Expandable List?

Aug 5, 2010

I am playing around with this example.
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.html

I cannot figure out how to attach a listener to the children elements so that I can trigger some action when the user taps on the phone number.

View 2 Replies View Related

Android :: Two Selectable Items In Each List In ListView

Dec 16, 2009

The way I want it is, per row there will be a text and is followed by a right arrow button, so that the user can click on that button to edit the content of that row. If the user is using the keypad, by using the left and right buttons on the keypad, he should be able to select the textview or the Button in that particular row. I have seen this in a couple of apps. The way I see that working on those apps appear as if they are maintaining two lists in parallel.

The reason i felt it this way is, if I am on row 1 of the list and if I press the right key on the phone keypad, then the right arrow button will get highlighted and now if I use the down key or if I keep pressing the down key, then the focus will scroll through that arrow button only as if that is an another parallel list constructed. I don't know if that is a good way to do it. I tried many for getting this to work, but couldn't succeed.

View 4 Replies View Related

Android :: ListView Not Selectable Anymore In Row Layout?

Sep 1, 2010

When I use a ImageButton in the ListView row, the ros is no selectable. When I change it to a ImageView it is selectable. I have this simple row layout, and below is my list , am I missing something simple?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="horizontal" android:id="@+id/layoutrowtop">
<ImageButton android:id="@+id/imgDetailDisclosure"
android:layout_height="fill_parent" android:layout_width="48dip"
android:layout_gravity="center_vertical" android:background="#00000000">
</ImageButton>

<RelativeLayout android:layout_width="wrap_content"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip"> <TextView android:id="@+id/firstLine"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:ellipsize="marquee" android:textStyle="bold"
android:textSize="18dp" android:singleLine="true"
android:gravity="top" > </TextView>

<TextView android:id="@+id/secondLine" android:layout_height="fill_parent"
android:layout_below="@+id/firstLine" android:layout_width="wrap_content"
android:ellipsize="marquee" android:textStyle="italic"
android:textSize="14dp" android:singleLine="false"
android:gravity="top" android:lines="2"> </TextView>
</RelativeLayout> </LinearLayout>

<LinearLayout android:layout_height="wrap_content" android:orientation="horizontal"
android:layout_width="fill_parent"> <EditText android:id="@+id/search_box"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="fill_parent" android:hint="type to filter" android:inputType="text"/>

<ImageButton android:id="@+id/search_button" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/icon_mag_glass"/>
</LinearLayout>
<!-- Set height to 0, and let the weight param expand it -->
<!-- Note the use of the default ID! This lets us use a ListActivity still! -->
<ListView android:id="@android:id/list" android:layout_width="fill_parent"
android:layout_height="0dip" android:layout_weight="1" />

View 2 Replies View Related

Android :: Make ListView Stop On A Finger Press?

Feb 7, 2009

How can I make the ListView immediately stop scrolling on a finger down event? It keeps scrolling if I give it a big swipe and doesn't stop immediately if my finger is pressed down again. Any idea?

View 3 Replies View Related

Android :: ListView Item From Custom Adapter Not Selectable

Jul 1, 2010

I'm making a custom adapter so that I can display a list of items with icons which looks like the menu that comes up when you long click the home screen. For some reason though the list items are not clickable. The can be navigated to with the D-pad but they cannot be clicked in any way. I thought maybe the problem was with the AlertDialog I was using so I replaced a working adapter I had elsewhere but I have the same issue there. My adapter looks like this:

ArrayList<IconListItem> mItems; LayoutInflater mInflater;
public IconListAdapter(Context context, ArrayList<IconListItem> items) {
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mItems = items;
} public IconListAdapter(Context context) {
this(context, new ArrayList<IconListItem>());
} public void add(IconListItem item) { mItems.add(item);
notifyDataSetChanged(); return item;
} public void remove(IconListItem item) { mItems.remove(item); notifyDataSetChanged();
} @Override public int getCount() { return mItems.size();
} @Override public IconListItem getItem(int position) { return mItems.get(position);
} @Override public long getItemId(int position) { return position;
} @Override public View getView(int position, View convertView, ViewGroup parent) { View view;
if(convertView == null){ view = mInflater.inflate(R.layout.two_line_icon_list_item, null);
} else { view = convertView; } IconListItem item = mItems.get(position);

TextView lineOne = (TextView) view.findViewById(R.id.firstLine);
TextView lineTwo = (TextView) view.findViewById(R.id.secondLine);
ImageView iconImage = (ImageView) view.findViewById(R.id.icon);
lineOne.setVisibility(View.VISIBLE); lineTwo.setVisibility(View.VISIBLE);
iconImage.setVisibility(View.VISIBLE); lineOne.setText(item.getText());
if (item.getSubtext() == null) lineTwo.setVisibility(View.GONE);
else lineTwo.setText(item.getSubtext());
if (item.getIcon() == null) iconImage.setVisibility(View.GONE);
else iconImage.setImageDrawable(item.getIcon());
return view; }

And the XML it's inflating:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="6dip" >
<ImageView android:id="@+id/icon" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_marginRight="6dip" />
<LinearLayout android:orientation="vertical" android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="fill_parent" >
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1"android:gravity="center_vertical"
android:id="@+id/firstLine" android:ellipsize="marquee" android:inputType="text" />
<TextView android:layout_width="wrap_content" android:layout_height="0dip"
android:layout_weight="1" android:ellipsize="marquee"
android:id="@+id/secondLine" android:inputType="text" />
</LinearLayout> </LinearLayout>

When I say they are not clickable, I mean that they items do not highlight in orange when I press them nor does onItemClick ever get called. In my code I have this, a different adapter for another purpose and it works perfectly

this.foos= foos; fa = new FooAdapter(this.foos); fooList.setAdapter(fa);
// View the details for an item when it is selected
fooList.setOnItemClickListener(new OnItemClickListener() {
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Intent i = new Intent(MyActivity.this, MyOtherActivity.class);
i.putExtra("foo", ((fooAdapter)arg0.getAdapter()).getItem(arg2));
i.putExtra("list_position", arg2);
MyActivity.this.startActivityForResult(i, 0);
} } );

But when I swap out the first 3 lines for
IconListAdapter ila = new IconListAdapter(this);
ila.add(0, "Test 1", android.R.drawable.ic_menu_mylocation);
ila.add(0, "Test 2", android.R.drawable.ic_menu_edit);
ila.add(0, "Test 3", android.R.drawable.ic_menu_search);
groupList.setAdapter(ila);
I t stops working.

View 2 Replies View Related

Android :: Custom ListView Selected Item Children?

Oct 27, 2010

I have a custom listview row that contains a number of textView components. Instead of the "standard" single text item, I have created a item where each listview row contains several bits of information. For this example, I have a record id, a name, and a description for each row in the listview. I have my listview populated via
this.mDbHelper = new RecordDBAdapter(this); this.mDbHelper.open();
Cursor c = this.mDbHelper.fetchAllRecords(); startManagingCursor(c);
String[] from = new String[] {RecordDBAdapter.ROW_ID, RecordDBAdapter.NAME,
RecordDBAdapter.DESCRIPTION};
int[] to = new int[] {R.id.recordId, R.id.lblName, R.id.lblDescription};
// Now create an array adapter and set it to display using our row
SimpleCursorAdapter records = new SimpleCursorAdapter(this, R.layout.record_row, c, from, to); this.list.setAdapter(dives);

Now what I want is to be able to access the recordId value within each clicked item. I've tried to follow the Android tutorials to no avail. They do something like
Object o = adapter.getItemAtPosition(position);
but that still doesn't help either. What I really want is to get the value of the recordId within each selected listItem. Does anyone know how this would be accomplished? Here is my onItemClick event:
protected OnItemClickListener onListItemClick = new OnItemClickListener() {
@Override public void onItemClick(AdapterView<?> adapter, View view, int position, long rowId) {
// My goal is either to grab the value of the
// recordId value from the textView, or from the adapter.
//Object o = adapter.getItemAtPosition(position);
//Tried this, no joy
Intent intent = new Intent(NeatActivity.this, SomeOtherActivity.class);
// intent.putExtra("selectedRecordId",val); //val here is a numerical record row id being passed to another activity.
startActivity(intent); } };

View 1 Replies View Related

Make TextView Text Selectable?

May 5, 2011

I have a text view and I'm trying to make the text selectable. The docs say:

Quote:

Use setTextIsSelectable(boolean) or the TextView_textIsSelectable XML attribute to make this TextView selectable

But I can't get it to work I tried

Code:
Tv.setTextIsSelectable(true);
and I get

The method setTextIsSelectable(boolean) is undefined for the type TextView I tried

Code:
android:textIsSelectable="true"
in the xml and I get
No resource identifier found for attribute 'textIsSelectable' in package 'android'

View 2 Replies View Related

Android :: ListView - Making The Parent Expand To Show All Children When AddingListViews Within ListViews

Feb 9, 2010

Basically, I have a custom ListView in which each item looks like:

CODE:..........

The ListView in each item is GONE by default and is set to VISIBLE when the button is clicked. Everything seems to work fine with the exception that when the ListView is long enough to scroll, it is just kind of truncated. http://img38.imageshack.us/img38/3269/listviewproblem.png

Is this a problem with the maximum height of an individual list item? Is there a way to force the list item to expand and force the child listview to expand to show all children?

View 1 Replies View Related

Android :: How To Keep ListView Header From Scrolling With ListView Content?

Jun 24, 2009

There must be a way to do this. How can you tell a ListView that has a header to not scroll it when the user scrolls the contents? I want it to stay in a "stuck" position so that the user can always see what column the content applies to.

View 9 Replies View Related

Android : How To Avoid Touch Event

Aug 19, 2009

I am trying to use "setClickable(false)" + "setLongClickable(false)" + "setFocusableInTouchMode(false)" to disable Touch Event for every views but failed. When mouse clicks, OnTouchEvent() of some view will still be called. What I want is only to disable Touch event because my application need not Touch and Touch event will disturb the running of app. Is there any way to disable Touch ?

View 6 Replies View Related

Android :: ListView Not Scrolling?

Jul 7, 2010

I'm trying to make a layout that is something similar to how the android market is...where say under comments there is what appears to be a ListView but it does not scroll (the whole page scroll but not the comments). I'm not sure if its even a ListView but I want something that looks like the list view (ie. have those divider bars and what not but NOT SCROLLABLE). There are people suggesting to use a LinearLayout instead of a ListView but I also what the items to be clickable and open a new activity. Please help?

My current layout tree is like so
<LinearLayout>
<ScrollView>
<RelativeLayout>

I am looking to put content inside the RelativeLayout.

View 2 Replies View Related

Android :: ListView Scrolling To Top

May 22, 2010

I have a ListView with custom rows. When any of these rows is clicked, the ListView's data is regenerated. I'd like the list to scroll back to the top when this happens.

I initially tried using setSelection(0) in each row's OnClickListener to achieve this but was unsuccessful (I believe because the ListView loses its scroll position when its data is invalidated - so my call to
setSelection is undone. I still don't understand how the ListView decides where to scroll to after invalidation, though).

The only working solution I know of was given by Romain Guy here: http://groups.google.com/group/android-developers/browse_thread/thread/127ca57414035301

It involves (View.post)ing the call to _listView.setSelection(0). I found this to perform quite poorly.
The newly generated list shows up with its scroll location unchanged and there is a considerable delay before it scrolls back to the top.

Is there any better way to achieve this functionality?

View 2 Replies View Related

Android :: Scrolling In A ListView?

Aug 19, 2010

In one of my projects I've got a ListView with hundreds of elements. But when scrolling through this list I get the following error:

CODE:.....................

View 6 Replies View Related

Android :: Touch Mode Catch Scrolling Direction

Oct 20, 2010

I want to ask that is that possible do in android catch the in the touch mode catch the scrolling direction ? When user touch on the screen left to right, can I catch the change ?
If it is possible which listener can ı use ?

I found some of the methods and listeners but I 'm not sure that therse are represent my requirement .
http://developer.android.com/reference/android/text/method/Touch.html

Public Methods
static int getInitialScrollX(TextView widget, Spannable buffer)
static int getInitialScrollY(TextView widget, Spannable buffer)

View 2 Replies View Related

Android :: Popup Menu On Touch Event

May 14, 2010

I am writing rtsp client using MediaPlayer class , i am showing menu using onCreateOptionsMenu() which popup menu on hardware menu button. Now i want menu popup on touch screen also , i can capture touch screen event but how to popup menu on that event.

View 2 Replies View Related

Android :: Not Getting Touch Event For List Activity

May 21, 2010

I have created ListActivity of images i want touch event just like onItemClickListner how can i do it? i'm not finding any on Item Toch Listener.

View 2 Replies View Related

Android :: Get Touch Event In Any View (droid)?

Oct 19, 2010

I need to make a service that capture all touch events, not in a specific view or when an specific activity is open. This service is started when the boot is completed (and I have an app to stop/play this service when I want it). So it write something (in a Toast) when the user touch any place in the screen.

Can I do this? Or only in specifics things (with OnTouchListener and adding specifics views, for example)?

View 1 Replies View Related

Android :: Handle All Input Key An Touch Event?

Sep 1, 2010

How handle all input key an touch event incoming to my Android application?

Is any one place where I can catch all this events?

View 2 Replies View Related

Android : Catch Touch Event Before It Gets To Each Of Those Views?

Mar 9, 2010

Actually I'm trying to implement an ontouchlistener into my android (1.5) application. therefore i implemented the "ontouchlistener" into the class, and then i put my code into the: So isn't there a way to catch the touch event before it gets to each of those views?

View 1 Replies View Related

Android : Get Co-ordinates Of A Touch Event On Droid?

May 30, 2010

I'm new to Android, I've followed the hello world tutorial through and have a basic idea of what's going on. I'm particularly interested in the touch screen of my T-Mobile Pulse so just to get me started I want to be able to write the co-ordinates of a tocuh event on the screen, so say the user touched the co-ordinate 5,2 - a textview on the screen would display that.

At present I have a simple program that just loads an xml file which contains the textview I intend to write the co-ordinates in.

Thank you in advance, I did Google for help and searched stackoverflow but everything I found either went way over my head or wasn't suitable for this.

View 2 Replies View Related

Android : Differentiate Between Touch Event And Drag?

Oct 12, 2010

I need your help in differentiate between touch event and drag. since I need to do action when user touch the screen and another action when it touch and drag. I wrote the code below but it only works for touch but not for drag. ret is the return value of the onTouch method. Code...

View 4 Replies View Related

Android :: Touch Mode Catch Scrolling Direction / Left To Right

Oct 20, 2010

I want to ask that is that possible do in android catch the in the touch mode catch the scrolling direction ? When user touch on the screen left to right, can I catch the change ? If it is possible which listener can ı use ?

I found some of the methods and listeners but I 'm not sure that therse are represent my requirement . http://developer.android.com/reference/android/text/method/Touch.html

Public Methods static int getInitialScrollX(TextView widget, Spannable buffer) static int getInitialScrollY(TextView widget, Spannable buffer)

View 2 Replies View Related

Android : Disable Scrolling Touch Events In ScrollView Programmatically?

Aug 10, 2009

Just wondering if there is an easier way to simply stop ScrollView from being scrolled via touch inputs? I will programmatically get the ScrollView to scroll to top or bottom.

As a last resort, I guess I will have to inherit from ScrollView and capture all the ontouch events. But wondering if there is an easier way before I take this approach?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved