在Android中如何垂直滚动活动 [英] How to vertical scroll an activity in Android

查看:105
本文介绍了在Android中如何垂直滚动活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下布局:

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
  机器人:方向=垂直
  机器人:layout_width =FILL_PARENT
  机器人:layout_height =FILL_PARENT
  机器人:isScrollContainer =真正的>
   <画廊机器人:ID =@ + ID /画廊
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:重力=底部/>
  <的LinearLayout机器人:ID =@ + ID /图机器人:方向=横向
    机器人:layout_width =FILL_PARENT机器人:layout_height =WRAP_CONTENT
    机器人:layout_weight =1/>
< / LinearLayout中>
 

画廊充满在运行时,当用户点击一个项目我填的LinearLayout了一系列图像。 我想垂直滚动,但如果我增加一个滚动型,当用户点击的LinearLayout不再被填补了画廊。

这是正常的?我该怎么做才能增加垂直滚动?

感谢和问候 ℃。

解决方案

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
  机器人:方向=垂直
  机器人:layout_width =FILL_PARENT
  机器人:layout_height =FILL_PARENT>
<滚动型机器人:ID =@ + ID / ScrlView机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT>
 <的LinearLayout机器人:ID =@ + ID / layoutForScroll机器人:方向=垂直
    机器人:layout_width =FILL_PARENT机器人:layout_height =WRAP_CONTENT
    >
   <画廊机器人:ID =@ + ID /画廊
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:重力=底部/>
  <的LinearLayout机器人:ID =@ + ID /图机器人:方向=横向
    机器人:layout_width =FILL_PARENT机器人:layout_height =WRAP_CONTENT
    机器人:layout_weight =1/>
< / LinearLayout中>
< /滚动型>
< / LinearLayout中>
 

i have the following layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:isScrollContainer="true">
   <Gallery android:id="@+id/gallery"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="bottom"/>
  <LinearLayout android:id="@+id/chart" android:orientation="horizontal"
    android:layout_width="fill_parent" android:layout_height="wrap_content"          
    android:layout_weight="1" />
</LinearLayout>

Gallery is filled at runtime and when the user taps on an item i fill the LinearLayout with a series of images. I would like to scroll vertically but if i add a ScrollView when the user taps the Gallery the LinearLayout is not filled anymore.

Is it normal? How can i do to add vertical scroll?

Thanks and greetings c.

解决方案

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
<ScrollView android:id="@+id/ScrlView" android:layout_width="fill_parent" android:layout_height="fill_parent" >
 <LinearLayout android:id="@+id/layoutForScroll" android:orientation="vertical"
    android:layout_width="fill_parent" android:layout_height="wrap_content"        
    >
   <Gallery android:id="@+id/gallery"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="bottom"/>
  <LinearLayout android:id="@+id/chart" android:orientation="horizontal"
    android:layout_width="fill_parent" android:layout_height="wrap_content"          
    android:layout_weight="1" />
</LinearLayout>
</ScrollView>
</LinearLayout>

这篇关于在Android中如何垂直滚动活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆