2017-05-09 16 views
-2

我正在製作新聞應用程序並使用列表視圖在應用程序中顯示項目。我怎樣才能讓我的activity_main.xml文件中的圖像滾動?這是我的activity_main.xml代碼。如何使用列表視圖在新聞應用程序中顯示某些項目?

?xml version="1.0" encoding="utf-8"? 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <!-- Layout for a list of earthquakes --> 
<ImageView 
      android:id="@+id/home_image" 
      android:layout_width="match_parent" 
      android:layout_height="180dp" 
      android:scaleType="centerCrop" 
      android:src="@drawable/qtc" /> 
<TextView 
      android:id="@+id/emptyView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/home_image" 
      android:layout_centerInParent="true" 
      android:gravity="center" 
      android:paddingTop="4dp" 
      android:textSize="25sp" /> 

     <ListView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/list" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@id/home_image" 
      android:dividerHeight="4dp" 
      android:orientation="vertical" 
      android:paddingBottom="8dp" 
      android:paddingLeft="8dp" 
      android:paddingRight="8dp" 
      android:paddingTop="8dp" /> 

     <ProgressBar 
      android:id="@+id/progress_indicator" 
      style="@style/Widget.AppCompat.ProgressBar" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" /> 

    </RelativeLayout> 
+0

將它放在列表視圖標題中,它將滾動列表視圖。 –

回答

相關問題