I am using a HorizentalScrollView in a view. I add TextView at runtime. I use horView.smoothScrollTo(x,y); It works fine for simulator. But it doesn’t scroll at HTCDesire 2.2 ? any idea? here my code.
horView.smoothScrollTo(num, 0);
<HorizontalScrollView
android:id="@+id/cate_head"
android:scrollbars="none"
android:foregroundGravity="fill_horizontal"
android:layout_width="fill_parent"
android:paddingTop="6dip"
android:background="@drawable/slider_background"
android:focusable="true"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/cate_head_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip">
</LinearLayout>
</HorizontalScrollView>
At the end I found solution. I was calling smoothScrollTo(x,y) at the end of on create.(where else I can put that?) problem was that at the time of initializing there was not size or length found(But it should not be, because I have put all the data in that).
So call postDealy() with a delay of 50 sec. It works for me. Here is that. I put it at the end of onCreate();
May b anyone else have a batter solution…