- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我必须在全屏模式下开发一个应用程序,现在我有一个公式带有一些文本编辑器和一些按钮。如果键盘弹出它隐藏两个按钮,所以我将所有内容都放入 ScrollView 中:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
tools:context="controller.RegsiterActivity" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/register_textview_firstname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:singleLine="true"
android:text="@string/text_firstname" />
<EditText
android:id="@+id/register_textedit_firstname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:inputType="text" />
<TextView
android:id="@+id/register_textview_lastname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:singleLine="true"
android:text="@string/text_lastname" />
<EditText
android:id="@+id/register_textedit_lastname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:inputType="text" />
<TextView
android:id="@+id/register_textview_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:singleLine="true"
android:text="@string/text_email" />
<EditText
android:id="@+id/register_textedit_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:inputType="textEmailAddress" />
<TextView
android:id="@+id/register_text_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:singleLine="true"
android:text="@string/text_password" />
<EditText
android:id="@+id/register_textedit_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:inputType="text" />
<Button
android:id="@+id/register_button_register"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_register" />
<Button
android:id="@+id/register_button_cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_cancel" />
</LinearLayout>
</ScrollView>
正如我所说,我必须全屏运行我的应用程序:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
但是当我现在运行我的应用程序时,没有出现 scrollView,也没有滚动工作。
我怎样才能使 scrollView 工作?
最佳答案
您应该添加到 ScrollView
的第一个属性是:
android:fillViewport="true"
当设置为 true 时,此属性会导致 ScrollView 的子项在需要时扩展到 ScrollView 的高度。当子级高于 ScrollView 时,该属性无效。
此外,将 fill_parent
布局尺寸更改为 match_parent
,因为 fill_parent
已弃用,您可以摆脱任何烦人的警告。
此外,将 LinearLayout
的 layout_height
属性更改为 match_parent
以便它会随 ScrollView
一起调整大小屏幕配置更改,例如拉起键盘。
此外,与@karvoynistas 的建议类似,您应该看看 windowSoftInputMode
属性(property)。
您可以将此属性添加到您的 Activity 中:
<activity
android:windowSoftInputMode="stateVisible|adjustResize"
...>
<!-- ... -->
</activity>
这样做的效果是(根据 Android docs
):
To ensure that the system resizes your layout to the available space—which ensures that all of your layout content is accessible (even though it probably requires scrolling)
将 adjustPan
值添加到 windowSoftInputMode
属性可能有效,但并不是您想要的,因为它可能会导致一些异常影响(请阅读下文)。
Android Docs 两个值的比较:
调整调整大小
The activity's main window is always resized to make room for the soft keyboard on screen.
调整平移
The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.
关于android - 全屏 ScrollView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26562402/
我正在尝试创建一个类似于 BBC 新闻 native 应用程序的布局(使用known.js);一个垂直的ScrollView,其中有许多水平的ScrollView。我已经“工作”到了一切都渲染并且水平
我正在尝试创建一个类似于 BBC 新闻 native 应用程序的布局(使用known.js);一个垂直的ScrollView,其中有许多水平的ScrollView。我已经“工作”到了一切都渲染并且水平
我已经为以下问题寻找了很多答案,但没有找到合适的解决方案(也不是“不可能”)。我不想要双向 ScrollView! 我想要的只是拥有这样的东西: 如果我这样做(具有所需的布局属性),我会得到我的
我想使用 famo.us 标准 Scrollview但是有一个以不同速度滚动的背景图像以产生视差效果。 我想知道是否有一种方法可以连接到事件流,或者以某种方式将 Scrollviews 位置通过管道传
初始化程序中有一个带有 ScrollView(alwaysBounceVertical: false) 的属性,但我似乎找不到它了。 有谁知道如何禁用 SwiftUI ScrollView 上的垂直弹
在你说之前 “Google 说不要这样做” 请阅读我的所有问题!! 布局: ScrollView -> RelativeLayout -> ScrollView -> RelativeLayout 第
我想在 Windows 7 上创建一种体验(使用触摸),我可以在其中拥有一个只能垂直滚动的外部 ScrollViewer(它是屏幕的大小)。在那个 ScrollViewer 中,我将有几个其他的 Sc
我知道 Google 的人要求我们不要将 Scrollable View 放在另一个 Scrollable View 中,但他们是否有任何官方声明指示我们不要这样做? 最佳答案 试试这个 注意:这里
更新Xcode11 beta3后,我发现scrollview内部 View 的阴影会在边界处被切断,但在Xcode11 beta2中还可以。我只是使用底部填充来修复它,但我认为这不是一个好的解决方案。
我的 wpf 应用程序的结构如下: 我的目标是,如果 DataGrid 超过屏幕的高度来使用它自己的 Scrollviewer。目前只使用外部的 S
我在其他应用程序中使用了 ScrollView,只添加了 style={styles.container}与风格。然而,在这个应用程序中,我正在创建我的风格 alignItems:'flex-star
这是我的布局 xml。 ... 我已经尝试过此链接中的解决方案: ScrollView Inside ScrollVie
有没有办法在 nativescript 的 ScrollView 上隐藏滚动指示器?我试过 scrollBars='none' 和 css overflow='hidden' 但它不能同时工作。谢谢
所以我有一个 ScrollView ,里面有一个 TextView 。当文本的String长于屏幕宽度时,它只是在下一行中移动。我想通过在 ScrollView 中添加 HorizontalScr
我正在尝试在 android 的水平 ScrollView 中创建一个水平 ScrollView 。第一个水平 ScrollView 工作正常。当我尝试滚动时,第二个水平 ScrollView 不起作
我在同一布局中创建了两个 ScrollView。你可以说一个平行的 ScrollView 。我想手动滚动一个 ScrollView ,作为响应,另一个 ScrollView 应该以完全相同的方式滚动。
我在 android 中设计 UI,我在另一个 HorizontalScrollView 中有一个 HorizontalScrollView。但是,子 HorizontalScrollVi
我在另一个 ScrollView 中有 ScrollView 。我想滚动内部 ScrollView ,但外部 ScrollView 只滚动。如何解决这个问题? 谢谢。 最佳答案 sv01 =
我有两个 UIScrollView,如果用户在 ScrollView 中滚动,我想让另一个 ScrollView 也滚动。我已经阅读了一个解决方案,涉及将 pangesturerecognizer 从
我以编程方式创建了 UIScrollView 并向其中添加了多个 button。 它运行良好,没有任何问题。 但我需要通过复制先前 ScrollView 的内容来创建另一个 ScrollView 。
我是一名优秀的程序员,十分优秀!