我现在做了一个界面可以读取一个文件夹里的图片,图片的存放是有先后顺序的,排布的时候以中间的为基准向两边辐射,我现在用三个ImageView去显示图片,xml用的相对布局,如下
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/imageCenter"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_centerHorizontal="true" />
<ImageView android:id="@+id/imageLeft"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_toLeftOf="@id/imageCenter" />
<ImageView android:id="@+id/imageCenter"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_toRightOf="@id/imageCenter" />
</RelativeLayout>
</HorizontalScrollView>
但是显示的时候,左边的那个不能显示,如果以最左边的为基准,三张可以正常显示。怎么样才能以中间的为基准呢,就是屏幕进去后可以看到中间的一张 ,然后往两边滑动着看。还有就是每张的间隙特别大 。怎样让他们间隙为零