Android 如何删除库中的空间
我有两个图库。分别是图像图库和文本图库。两个图库的开头和结尾都有空间。都是相对布局。我不明白是什么问题。请帮助 我还发布了我的代码:Android 如何删除库中的空间,android,Android,我有两个图库。分别是图像图库和文本图库。两个图库的开头和结尾都有空间。都是相对布局。我不明白是什么问题。请帮助 我还发布了我的代码: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView android:text="Airing Now"
android:id="@+id/titletextview"
android:textSize="22dip"
android:textColor="@color/textcolor"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TextView>
<Gallery
android:id="@+id/Gallery_image"
android:layout_below="@+id/titletextview"
android:spacing="15dip"
android:padding="15dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</Gallery>
<ImageView android:id="@+id/ImageView"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ImageView>
<Gallery
android:id="@+id/gallery_text"
android:layout_below="@+id/Gallery_image"
android:layout_width="fill_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
我在画廊视图的开头和结尾都有空间。我想这是因为android:gravity=“center\u卧式”。另外,android:padding=“15dip”添加了所有四个填充。只添加paddingLeft和paddingRight。为了解决这个问题,我通常会通过编程更改布局参数。在getView()中拥有ImageView(在本例中称为iv)后,可以执行以下操作:
iv.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.FILL_PARENT, Gallery.LayoutParams.FILL_PARENT));
iv.setScaleType(ScaleType.FIT_CENTER);
你可以发布你的布局xml吗。您必须编辑您的问题并添加布局详细信息。检查这些链接,您好,谢谢..我检查了这些链接,但它不起作用…android:padding=“15dip”添加了所有四个填充。只添加paddingLeft和paddingright这将如何解决问题?它只是使每个画廊项目与屏幕一样宽,图像居中。