使用SlidingDrawer的隐藏/显示搜索框

局部布局:

<LinearLayout
		android:orientation="horizontal"
		android:layout_width="250dp" 
		android:layout_height="wrap_content" 
		android:layout_centerVertical="true"
		android:layout_alignParentRight="true"
		>
	<SlidingDrawer 
		android:id="@+id/slidingdrawer"
		android:layout_width="fill_parent"
		android:layout_height="fill_parent" 
		android:handle="@+id/handle"
		android:content="@+id/search" 
		android:orientation="horizontal"
		>
			<ImageView android:id="@+id/handle"
						android:layout_width="wrap_content" 
				android:layout_height="wrap_content" 
				android:src="@drawable/search2"
				android:scaleType="fitCenter"
				 />
			<AutoCompleteTextView 
				android:id="@+id/search"
				android:layout_width="fill_parent" 
				android:layout_height="wrap_content" 
				android:hint="个股查询"
				android:singleLine="true"
				android:completionThreshold="1"
				/>
	</SlidingDrawer>
</LinearLayout>


使用一看就明白:
mDrawer = (SlidingDrawer) findViewById(R.id.slidingdrawer);
		mDrawer.setOnDrawerOpenListener(new SlidingDrawer.OnDrawerOpenListener() {
			@Override
			public void onDrawerOpened() {
			}

		});

		mDrawer.setOnDrawerCloseListener(new SlidingDrawer.OnDrawerCloseListener() {
			@Override
			public void onDrawerClosed() {
			}

		});

		mDrawer.setOnDrawerScrollListener(new SlidingDrawer.OnDrawerScrollListener() {
			@Override
			public void onScrollEnded() {
			}

			@Override
			public void onScrollStarted() {
			}

		});


可以实现如下效果:
让AutoCompleteTextView 在屏幕的右面,使它不显示出来.当点击了ImageView后通过动画慢慢平移出来;再点击一下ImageView,又慢慢移动到屏幕外面.
http://www.eoeandroid.com/forum.php?mod=viewthread&tid=67554&page=1#pid685961

Android 3.0 r1 API中文文档——SlidingDrawer
http://www.cnblogs.com/over140/archive/2011/04/04/2005078.html


Android提高第十九篇之"多方向"抽屉
http://blog.csdn.net/hellogv/archive/2011/03/21/6264706.aspx

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