0

i have crated nested view for list view row . also i have used horizontal scroll view to scroll horizontally in particular row. but in some number of row i want to have scrolling facility from right to left. i search about this i found something smoothscrollto="20dp" but it wont work at all.

Edited text I Added holder.hv.smoothScrollTo(holder.hv.getRight(), holder.hv.getTop()); in my image-view on click listener and when i click on that image-view my horizontal scroll view shift to end(right).. how can i make it possible to scroll that particular row without click listener Here is my code

 public View getView(int position, View convertView, ViewGroup parent) {
    final ViewHolder holder;
    int type = getItemViewType(position);
    System.out.println("getView " + position + " " + convertView + " type = " + type);
    if (convertView == null) {
        holder = new ViewHolder();
        switch (type) {
            case 0:
                convertView = inflater.inflate(R.layout.list_row1, null);
                 holder.hv = (HorizontalScrollView)convertView.findViewById(R.id.horizontalScrollView1);
                holder.videoview1 = ((ImageView)convertView.findViewById(R.id.train).findViewById(R.id.boogi1).findViewById(R.id.imageView1));
                Log.d("Listview", "front value is"+position);
                holder.videoview1.setTag(position);
                holder.videoview1.setOnClickListener(new OnClickListener() {                
                    @Override
                    public void onClick(View v) {
                        // TODO Auto-generated method stub

                        holder.hv.smoothScrollTo(holder.hv.getRight(), holder.hv.getTop());
                        }
                });


                break;
            case 1:convertView = inflater.inflate(R.layout.list_row2, null);
                holder.videoview1 = ((ImageView)convertView.findViewById(R.id.train2).findViewById(R.id.boogi2).findViewById(R.id.imageView1)); 
                holder.videoview1.setTag(position);
                holder.videoview1.setOnClickListener(new OnClickListener() {                
                    @Override
                    public void onClick(View v) {
                        // TODO Auto-generated method stub
                        Toast.makeText(context, "you right clicked"+v.getTag() , Toast.LENGTH_SHORT).show();                        
                    }
                });
                break;
        }
        convertView.setTag(holder);
    } else {

        holder = (ViewHolder)convertView.getTag();

    }

    return convertView;
}

any help is appreciated. Thank you

Swap-IOS-Android
  • 4,363
  • 6
  • 49
  • 77

2 Answers2

1

Please use this link Screenshot from My NEXUS 7 : enter image description here

Sunil Kumar
  • 7,086
  • 4
  • 32
  • 50
1

I solve this question with the help of @Appu and other member of stack overflow...

Just i added this code into the row which i want to scroll to right automatically

holder.hv.post(new Runnable() 
                {
                    public void run() 
                     {
   holder.hv.smoothScrollTo(holder.hv.getRight()+80, holder.hv.getTop());

// Hv is horizontalscrollview

                     }
                  });
Swap-IOS-Android
  • 4,363
  • 6
  • 49
  • 77