I tried a lot for having scrolling text horizontally inside a listview.
i want one of my textview to scroll horizontally automatically like marquee
iam able to set horizontal scroll bar and scroll on touching it as
TVad.setMovementMethod(new ScrollingMovementMethod());
This is my xml file
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:id="@+id/tvinboxname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/tvinboxmsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvinboxname"
android:maxLength="10"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/tvtimeStamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/tvinboxmsg"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/tvadmsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvtimeStamp"
android:ellipsize="marquee"
android:focusableInTouchMode="true"
android:inputType="text"
android:focusable="true"
android:marqueeRepeatLimit="marquee_forever"
android:lines="1"
android:scrollHorizontally="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#330066" />
and in my getview method
// @Override
public View getView(final int position, View convertView,
ViewGroup parent) {
convertView = inflater.inflate(R.layout.inboxtextviews, null);
Tvname = (TextView) convertView.findViewById(R.id.tvinboxname);
Tvname.setText(VCAESInboxWithOutCheckboxes.Inboxlist.get(position)
.getname());
TVmsg = (TextView) convertView.findViewById(R.id.tvinboxmsg);
TVmsg.setText(VCAESInboxWithOutCheckboxes.Inboxlist.get(position)
.getmessage());
TVtimeStamp = (TextView) convertView.findViewById(R.id.tvtimeStamp);
TVtimeStamp.setText(VCAESInboxWithOutCheckboxes.Inboxlist.get(
position).getTimeStamp());
TVad= (TextView) convertView.findViewById(R.id.tvadmsg);
TVad.setText(VCAESInboxWithOutCheckboxes.Inboxlist.get(
position).getAd());
TVad.setSelected(true);
);
return convertView;
}
i searched a lot on this in stackoverflow and not able to display the scrolling text.
Use custom class as shown below and
add it in xml file for custome listview like shown below