I've an horizontal listview with several textviews. I want to translate (animate) these textviews (items) only from right to left as a circular way, while click a button. Not translate the horizontal listview layout. Is this possible?
Edit:
For this horizontal listview, i used an adapter to load the values into that list.
Like this:
private static String[] dataObjects = new String[]{ "Text #1",
"Text #2",
"Text #3","Text #4","Text #5","Text #6","Text #7","Text #8","Text #9","Text #10" };
private BaseAdapter mAdapter = new BaseAdapter() {
@Override
public int getCount() {
return dataObjects.length;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@SuppressLint({ "ViewHolder", "InflateParams" })
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View retval = LayoutInflater.from(parent.getContext()).inflate(R.layout.viewitem, null);
TextView title = (TextView) retval.findViewById(R.id.title);
//Button button = (Button) retval.findViewById(R.id.clickbutton);
//button.setOnClickListener(mOnButtonClicked);
title.setText(dataObjects[position]);
return retval;
}
};
And set this adapter to the horizontal listview as:
listView=(HorizontalListView)findViewById(R.id.simple_list);
listView.setAdapter(mAdapter);
Thanks in advance...
Make translate.xml in res -> anim directory. Code:
Change percentages in
android:fromXDelta="100%" android:toXDelta="0%"
to fit your needs. Now use :