android给ScrollView中显示多个控件 --公司项目 在左边栏 加入滚条

 http://blog.csdn.net/sereneWorkshop/article/details/5250795

 

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout
		xmlns:android="http://schemas.android.com/apk/res/android"
    	android:orientation="vertical"
    	android:layout_height="wrap_content"
    	android:layout_gravity="center" 
    	android:layout_width="fill_parent"
    	android:scrollbars="vertical"
    	android:background="#FF000000">
    	<ScrollView
    		xmlns:android="http://schemas.android.com/apk/res/android"
    		android:layout_width="fill_parent"
    		android:layout_height="fill_parent">
    		<LinearLayout
				xmlns:android="http://schemas.android.com/apk/res/android"
				android:orientation="vertical"
    			android:layout_width="fill_parent"
    			android:layout_height="fill_parent"
    			android:background="#FFc0c0c0"
    			android:padding="10dip">
				<TextView
					android:id="@+id/about_content"
					android:layout_width="wrap_content"
					android:layout_height="wrap_content"
					android:text="@string/about_text"
					android:textColor="#FF000000"
					android:autoLink="all"
					android:textSize="20sp"/>
				<RelativeLayout
 					xmlns:android="http://schemas.android.com/apk/res/android"
 					android:layout_width="fill_parent" 
 					android:layout_height="wrap_content"
 					android:gravity="center">
					<ImageButton
						android:layout_gravity="center" 
						android:id="@+id/about_exit"
						android:src="@drawable/looks"
						android:background="#FF46333c"
						android:scaleType="center"
						android:layout_width="wrap_content"
						android:layout_height="fill_parent"
						android:text="@string/about_ok"/>
					<TextView android:id="@+id/about_text_exit"
						android:layout_height="fill_parent"
						android:layout_width="wrap_content"
						android:background="#FF46333c"
						android:text="Let's Go!"
						android:layout_toRightOf="@id/about_exit"
						android:layout_alignTop="@id/about_exit"
						android:layout_alignBottom="@id/about_exit"
						android:clickable="true"/>
				</RelativeLayout>
			</LinearLayout>
		</ScrollView>
</LinearLayout>

 

 

在左边栏 ,加入 侧边 栏 滚条

<!-- 左边 块 -->
	<!-- Alex -->
	<ScrollView 
		android:layout_height="wrap_content"
		android:id="@+id/Left_layout_ScrollV"
		android:layout_width="wrap_content"
		
		android:layout_below="@+id/top"
		android:layout_above="@+id/bottom"
	>
	
			<RelativeLayout
				android:id="@+id/left_layout"
				android:background="@+drawable/filter_back"
				android:visibility="gone"
				android:layout_width="wrap_content"	
				android:layout_height="fill_parent">
			
				
			</RelativeLayout>
			
	</ScrollView>


 

 

 

 

--------------------------------------------------------------------------------以上是测试案例,一下是 项目中 解决自己问题的做法

 

将 ScrollView套在 left_layout 外面, 将 左边的 的布局 RelativLayout 的 想对布局 改为 ScrollView

因为  left_layout 中 有 backGround 所以 使得 滚条过长,所以再将 backgroud 去掉

 

<!-- 左边 块 -->
	<!-- Alex  将背景图 去掉 就解决过长的问题 了 android:background="@+drawable/filter_back"-->
	<ScrollView 
		
		android:id="@+id/Left_layout_ScrollV"
		android:layout_height="wrap_content" 
		 android:layout_width="wrap_content"
		android:layout_below="@+id/top"
		android:layout_above="@+id/bottom"
		
		android:fillViewport="true" 
	>
	
			<RelativeLayout
				android:id="@+id/left_layout"
				
				android:visibility="gone"
				android:layout_width="wrap_content"	
				android:layout_height="10dp"				
				>		
				
			</RelativeLayout>
			
	</ScrollView>


哈哈,今天的任务完成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值