Android

Android中如何实现GridView的水平拖动,固定行数,水平滚动!

用HorizontalScrollView包一下GridView

<HorizontalScrollView android:layout_width="fill_parent"
android:layout_height="match_parent">
<FrameLayout android:layout_width="fill_parent"
android:layout_height="match_parent">

<LinearLayout android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    
	<TextView  
	    android:layout_width="wrap_content" 
	    android:layout_height="wrap_content" 
	    android:text="@string/hello" /><!--
	    
	<include 
		layout="@layout/foot_navigation"
		android:id="@+id/foot_nav_lv_ll" />
		
	-->
	<HorizontalScrollView android:layout_width="wrap_content"
		android:layout_height="wrap_content">
		<FrameLayout android:layout_width="wrap_content"
			android:layout_height="wrap_content">
			<LinearLayout android:layout_width="wrap_content"
				android:layout_height="wrap_content" android:orientation="horizontal">
				<include layout="@layout/foot_navigation_gridview"
					android:id="@+id/foot_nav_gv_ll" />
			</LinearLayout>
		</FrameLayout>
	</HorizontalScrollView>
	
</LinearLayout>

你可能感兴趣的:(java,android,xml)