我正在学习Android应用程序开发,我必须显示内容和相关的预告片
为了显示文字内容,我使用了ScrollView
,但根据文档ScrollView
无法正常使用
我尝试使用LinearLayout
修复它,它在纵向模式下工作正常,但在横向模式下没有。我附上图片以便在视觉上解释。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/title"
android:background="@android:color/holo_red_dark"
android:textColor="#ffffff"
android:layout_gravity="center_horizontal"
android:layout_weight="0.07"
android:textSize="@dimen/abc_text_size_display_1_material" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="421dp"
android:id="@+id/scrollView"
android:layout_gravity="center_horizontal">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:paddingLeft="20dp"
android:paddingRight="40dp"
android:paddingTop="5dp"
android:paddingBottom="20dp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/releaseDate"
android:text="text"
android:textSize="@dimen/abc_text_size_large_material"
android:layout_marginBottom="@dimen/design_appbar_elevation"
android:layout_marginTop="15dp" />
<TextView
android:layout_below="@id/releaseDate"
android:id="@+id/voteAverage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text2"
/>
</RelativeLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/plotSynopsis"
android:text="@string/plot_synopsis"
android:textColor="@android:color/background_dark"
android:paddingLeft="5dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/overView"
android:textColor="#616161"
android:padding="@dimen/abc_text_size_body_2_material" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Trailers:"
android:id="@+id/trailersView"
android:paddingLeft="5dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:layout_width="match_parent"
android:layout_height="92dp"
android:id="@+id/movie_list_view" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
答案 0 :(得分:1)
Yes scroll view not working fine with listview you can use recyclerview on the place of listview that will be working fine and scroll smoothly.
<android.support.v7.widget.RecyclerView
android:id="@+id/profile_grid_images"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/text_recent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />