滚动horizontalscrollview时遇到问题。当我用手指在其中滑动时,它不会滚动得很好。这是我的布局:
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<include layout="@layout/progress_bar"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/annonce_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fadeScrollbars="false"
android:scrollbars="vertical" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/annonce_description"
android:layout_marginTop="16dp"
android:background="@android:color/transparent"
android:fadeScrollbars="false" >
<LinearLayout
android:id="@+id/images_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
</ScrollView>
我通过ImageView填充images_container,如下所示:
ViewGroup vg = (ViewGroup) this.rootView
.findViewById(R.id.images_container);
if (vg.getChildCount() == 0 && this.an.getSomeUrlsImage() !=null)
for (String imageUrl : this.an.getSomeUrlsImage()) {
ImageView img = new ImageView(getActivity());
img = ImageConfig.setDefaultConfigForImageView(img);
this.imageDownloader.download(imageUrl, img);
vg.addView(img);
}
这是ImageConfig类代码:
public class ImageConfig {
public static ImageView setDefaultConfigForImageView(ImageView v){
v.setPadding(6, 6, 6, 6);
v.setMinimumHeight(156);
return v;
}
}
你有任何想法解决这个问题吗?
谢谢!