[英]EditText in scroll view in android
I try to create a from application, in the app I have a lengthy form which I want to be in a scroll view, But when I add EditText to the scrollView ..the eclipse shows some error in its designer view. 我尝试创建一个from应用程序,在应用程序中我有一个冗长的形式,我想在滚动视图中,但当我将EditText添加到scrollView ..日食在其设计器视图中显示一些错误。
error!
IllegalStateException: ScrollView can host only one direct child
Exception details are logged in Window > Show View > Error Log
Any one have an idea to crack it out? 任何人都有想法解决它?
I have included this code after getting a solution for the above trouble..! 在获得上述问题的解决方案之后,我已经包含了此代码..!
Now the EditText is not showing any typed text, it just gives some suggestions...! 现在EditText没有显示任何类型的文本,它只是提供了一些建议......!
I have the following XML : 我有以下XML:
<ScrollView
android:id="@+id/widget64"
android:layout_width="320px"
android:layout_height="358px"
android:fillViewport="true"
android:isScrollContainer="true"
android:saveEnabled="true">
<TableLayout
android:id="@+id/widget58"
android:layout_width="320px"
android:layout_height="65px"
android:orientation="vertical"
>
<TableRow
android:id="@+id/widget60"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/user"
android:text="User"
android:textColor="#000000">
</TextView>
</TableRow>
<TableRow
android:id="@+id/widget60"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
>
<EditText
android:id="@+id/users_first_name"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:hint="First Name"
android:focusable="true"
android:inputType="textPersonName"
android:enabled="true"
android:ems="15">
</EditText>
</TableRow>
</TableLayout>
</ScrollView>
Found the trouble..... My emulator key was set to Chinese instead of English... 发现麻烦.....我的模拟器密钥设置为中文而不是英文...
首先将任何布局添加到该滚动视图,然后将edittext添加到该布局。然后自动为该edittext滚动。例如:将Linearlayout添加到该滚动视图,然后将editText添加到taht linearlayout。
Yes, ScrollVew
can have only one child. 是的, ScrollVew
只能有一个孩子。 For this do something like this 为此,做这样的事情
<ScrollView
fillViewPortView = "true">
<RelativeLayout>
// Design the entire layout in here
// Put your elements one below the other. It will automatically scroll
// dont forget to setFillViewPort view to true in ScrollView
</RelativeLayout>
</ScrollView>
This will solve the problem for sure 这肯定会解决问题
Hope his help : ) 希望他的帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.