滚动布局内的滚动视图?

发布于 2024-12-29 08:00:11 字数 6686 浏览 0 评论 0原文

在此处输入图像描述

我需要你的帮助。基本上我创建了一个scrollView作为activity的父布局。现在我需要在活动中添加许多小部件,包括一个编辑文本,其中包含在此编辑文本中设置的大文本值,该编辑文本也是可滚动的,但编辑文本中的文本滚动不顺畅?我需要像小部件这样的文本区域,我的 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="fill_parent"
    >
    <LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:orientation="vertical" 
    android:background="#498BF4"> 
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Registration"
    android:gravity="center_horizontal" 
    android:textSize="20dip"/>
    </LinearLayout>

  <ScrollView 
    android:id="@+id/scroll" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >

    <LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:orientation="vertical" 
    >  
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="User_id:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/user">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="FirstName:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/fname">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="LastName:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/lname">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Email:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/email">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Currency:*"
    android:textSize="15dip"/>
    <Spinner 
    android:id="@+id/spinner1" 
    android:layout_width="fill_parent" 
    android:layout_height="40dip">
    </Spinner>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Date of Birth:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/dob">  
    </EditText>
    <LinearLayout 
    android:id="@+id/agepermission"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:orientation="vertical" 
    android:visibility="gone"> 
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="150dip" 
    android:id="@+id/ageterms"

    android:maxLines="10"
    android:textSize="10dip"
    android:text="@string/hello"
    >  
    </EditText>
    <CheckBox 
    android:text="I have permission to use the  website from parent/guardian.*" 
    android:id="@+id/checkBox1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content">
    </CheckBox>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Parent Name:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/pname">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Parent Email:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/pemail">  
    </EditText>
    </LinearLayout>

<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Terms and conditions:*"
    android:textSize="15dip"/>

    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="200dip" 
    android:id="@+id/terms"
   ![android:text="i need your help. Basically I created a scrollView as a parent layout of an activity . Now i need to add many widgets inside the activity including an edittext containing large text values set inside this edittext which is also scrollable , but my text inside an edit text not scrolling smoothly? i need text area like widgets i need your help. Basically I created a scrollView as a parent layout of an activity . Now i need to add many widgets inside the activity including an edittext containing large text values set inside this edittext which is also scrollable , but my text inside an edit text not scrolling smoothly? i need text area like widgets i need your help. Basically I created a scrollView as a parent layout of an activity . Now i need to add many widgets inside the activity including an edittext containing large text values set inside this edittext which is also scrollable , but my text inside an edit text not scrolling smoothly? i need text area like widgets i need your help. Basically I created a scrollView as a parent layout of an activity . Now i need to add many widgets inside the activity including an edittext containing large text values set inside this edittext which is also scrollable , but my text inside an edit text not scrolling smoothly? i need text area like widgets"][2]
    android:inputType="textMultiLine"
    android:textSize="10dip"
    >  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="By clicking on 'Sign Up' button below you are agreeing to the Terms of Service above and both the Program Policy and the Privacy Policy."
    android:textSize="15dip"/>
    <Button 
    android:text="Sign Up" 
    android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="40dip"
    >
    </Button>
    </LinearLayout>
   </ScrollView>
   </LinearLayout>

enter image description here

i need your help. Basically I created a scrollView as a parent layout of an activity . Now i need to add many widgets inside the activity including an edittext containing large text values set inside this edittext which is also scrollable , but my text inside an edit text not scrolling smoothly? i need text area like widgets , my xml code shown below

<?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"
    >
    <LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:orientation="vertical" 
    android:background="#498BF4"> 
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Registration"
    android:gravity="center_horizontal" 
    android:textSize="20dip"/>
    </LinearLayout>

  <ScrollView 
    android:id="@+id/scroll" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >

    <LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:orientation="vertical" 
    >  
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="User_id:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/user">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="FirstName:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/fname">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="LastName:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/lname">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Email:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/email">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Currency:*"
    android:textSize="15dip"/>
    <Spinner 
    android:id="@+id/spinner1" 
    android:layout_width="fill_parent" 
    android:layout_height="40dip">
    </Spinner>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Date of Birth:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/dob">  
    </EditText>
    <LinearLayout 
    android:id="@+id/agepermission"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:orientation="vertical" 
    android:visibility="gone"> 
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="150dip" 
    android:id="@+id/ageterms"

    android:maxLines="10"
    android:textSize="10dip"
    android:text="@string/hello"
    >  
    </EditText>
    <CheckBox 
    android:text="I have permission to use the  website from parent/guardian.*" 
    android:id="@+id/checkBox1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content">
    </CheckBox>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Parent Name:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/pname">  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Parent Email:*"
    android:textSize="15dip"/>
    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="40dip" 
    android:id="@+id/pemail">  
    </EditText>
    </LinearLayout>

<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Terms and conditions:*"
    android:textSize="15dip"/>

    <EditText
    android:layout_width="fill_parent" 
    android:layout_height="200dip" 
    android:id="@+id/terms"
   ![android:text="i need your help. Basically I created a scrollView as a parent layout of an activity . Now i need to add many widgets inside the activity including an edittext containing large text values set inside this edittext which is also scrollable , but my text inside an edit text not scrolling smoothly? i need text area like widgets i need your help. Basically I created a scrollView as a parent layout of an activity . Now i need to add many widgets inside the activity including an edittext containing large text values set inside this edittext which is also scrollable , but my text inside an edit text not scrolling smoothly? i need text area like widgets i need your help. Basically I created a scrollView as a parent layout of an activity . Now i need to add many widgets inside the activity including an edittext containing large text values set inside this edittext which is also scrollable , but my text inside an edit text not scrolling smoothly? i need text area like widgets i need your help. Basically I created a scrollView as a parent layout of an activity . Now i need to add many widgets inside the activity including an edittext containing large text values set inside this edittext which is also scrollable , but my text inside an edit text not scrolling smoothly? i need text area like widgets"][2]
    android:inputType="textMultiLine"
    android:textSize="10dip"
    >  
    </EditText>
    <TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="By clicking on 'Sign Up' button below you are agreeing to the Terms of Service above and both the Program Policy and the Privacy Policy."
    android:textSize="15dip"/>
    <Button 
    android:text="Sign Up" 
    android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="40dip"
    >
    </Button>
    </LinearLayout>
   </ScrollView>
   </LinearLayout>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乄_柒ぐ汐 2025-01-05 08:00:11

如果输入是多行,请在 edittext 中使用以下标记

   android:inputType="textMultiLine"

use below tag in your edittext , if it input is multiline

   android:inputType="textMultiLine"
叶落知秋 2025-01-05 08:00:11

我这里也有同样的问题。

到目前为止,我知道唯一的解决方案是当 EditText 获得焦点时禁用 ScrollView 的滚动。

I am having the same problem here.

So far I know the only solution is to disable the scrolling of the ScrollView when the EditText got focus.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文