Java Android studio图像水平滚动视图
因此,我试图实现一个小的图像库,但到目前为止,我所做的工作导致图像彼此间隔开。我想知道是否有人能提出更好的方法Java Android studio图像水平滚动视图,java,android,xml,Java,Android,Xml,因此,我试图实现一个小的图像库,但到目前为止,我所做的工作导致图像彼此间隔开。我想知道是否有人能提出更好的方法 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http:/
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_qavel_nav"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80CBC4"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.chiraag.qavel.QavelNav"
tools:showIn="@layout/app_bar_qavel_nav"
>
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="95dp"
android:id="@+id/tvDisplayDate"
android:textColor="@android:color/black"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvDisplayDate"
android:layout_alignParentStart="true"
android:layout_marginTop="139dp"
android:id="@+id/textView2" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/textView2"
android:background="#00796B"
android:layout_marginTop="10dp"
android:padding="5dp"
android:layout_gravity="center_horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/img1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/four_pillars"
/>
<ImageView
android:id="@+id/img2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/marriotts_walk"
/>
<ImageView
android:id="@+id/img3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/frankie_bennies"
/>
<ImageView
android:id="@+id/img4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/blue_boar"
/>
</LinearLayout>
</HorizontalScrollView>
如果要抑制图像之间的任何附加sapce,可以强制填充和边距为0,或尝试放置负片值。例如:
padding-bottom:-10dp;
您可以使用RecyclerView并将旋转设置为90度,使其水平增长或与NestedScrollView相同。