Please watch the customer name and country and arrow in the list view ,i would like to implement the same effect for text view in my application. i.e the text should place at left side and right side arrow mark and if we touches the textview it should display some other screen.
Asked
Active
Viewed 621 times
0
-
[Segmented Radio Buttons for Android](https://github.com/makeramen/android-segmentedradiobutton) – Adil Soomro Jan 03 '13 at 16:06
-
TextView support Drawable right,Top,Left,Bottom property you can bind event on it please refer http://stackoverflow.com/questions/11753816/drawableright-of-edittext – Dixit Patel Jan 03 '13 at 16:09
-
@Andil atleat give some related answer. – Priyanka Jan 03 '13 at 16:12
1 Answers
0
That would not be a single TextView but rather one list item RelativeLayout or LinearLayout with two TextViews inside of it and an ImageView for the arrow graphic on the right. It would be with a ListActivity or ListFragment which would handle the touching for you, taking you to another screen.
http://developer.android.com/reference/android/app/ListFragment.html
As shown on the site, your code would be something like:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/name"
android:textSize="16sp"
android:textStyle="bold"
android:alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/country"
android:textSize="16sp"
android:alignParentLeft="true"
android:layout_below="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alignParentRight="true"/>
Then just tweak it accordingly.
EDIT---
Once you have your view in XML, then you can add a click listener like this in your Activity:
LinearLayout layout = (LinearLayout) findViewById(R.id.linear_layout);
layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Do your code here to switch to another view or activity
}
});

leenephi
- 900
- 5
- 13
-
i have only one text view and image view so i am placing them in a linear layout .trying to make touch effect for the layout. – Priyanka Jan 03 '13 at 16:17
-
Are you using a ListView or ListFragment? That's what you would want if you're trying to achieve what the picture has that you posted. – leenephi Jan 03 '13 at 16:19
-
In the image if we touch any where on the list item i.e contact name ,country ,arrow it redirects to some other screen ,i would like to implement the same effect. – Priyanka Jan 03 '13 at 16:24
-
but i have only one item so not interested in using list view or list fragment is there any other way to do this? – Priyanka Jan 03 '13 at 16:25
-
I edited my answer. Add a click listener to your LinearLayout; that should do it! – leenephi Jan 03 '13 at 16:29