GridView 实现水平拖拉效果

im_chat_head.xml:

 

 

<?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="40dp">
	<HorizontalScrollView android:layout_width="fill_parent"
		android:scrollbars="none" android:layout_height="fill_parent">
		<FrameLayout android:layout_width="fill_parent"
			android:layout_height="fill_parent">
			<LinearLayout android:layout_width="800dip"
				android:id="@+id/lt_chat_head_total" android:layout_gravity="right"
				android:layout_height="fill_parent" android:orientation="horizontal">
				<GridView android:layout_width="wrap_content"
					android:numColumns="auto_fit" android:layout_height="50dip"
					android:id="@+id/gv_chat_user_head"></GridView>
			</LinearLayout>
		</FrameLayout>
	</HorizontalScrollView>
</LinearLayout>

 

这里将android:scrollbars="none" 设置none使得滚动的那个跳栏不可见

 

im_chat.xml:

 

 

 

<include android:id="@+id/im_chat_wrap_head"
			android:visibility="visible" android:layout_alignParentTop="true"
			android:layout_width="fill_parent" android:layout_gravity="right"
			android:layout_height="wrap_content" layout="@layout/im_chat_head">
</include>
 

 

 

效果图:

 

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