gpt4 book ai didi

android - 启用调整大小或滚动键盘弹出的 Activity

转载 作者:行者123 更新时间:2023-11-29 19:15:00 27 4
gpt4 key购买 nike

我已经看到许多关于如何禁用滚动 Activity 文本字段的标准 Android 行为或在弹出屏幕键盘时调整当前 Activity 大小的帖子,但我的问题恰恰相反。我的应用程序既没有滚动也没有调整大小。

我必须做什么才能实现正确的行为?

<?xml version="1.0" encoding="utf-8"?>

<!-- The main content view -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?colorPrimary">

<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="@+id/slidingPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoFadeColor="@android:color/transparent"
sothree:umanoOverlay="true"
sothree:umanoPanelHeight="200dp"
sothree:umanoShadowHeight="0dp">

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="@dimen/lewa_lista_size"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="?xenoPanelBackgroundColor"/>
</android.support.v4.widget.DrawerLayout>

<RelativeLayout
android:id="@+id/playlist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">

<LinearLayout
android:id="@+id/chwytak"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/tlo_kropek"
android:orientation="vertical">

<ImageView
android:id="@+id/kropki"
android:layout_width="match_parent"
android:layout_height="@dimen/uchwyt_szuflady_height"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:src="@mipmap/kropki" />

<RelativeLayout
android:id="@+id/wypelniaczGorny"
android:layout_width="match_parent"
android:layout_height="0dp"/>
</LinearLayout>

<android.support.v7.widget.Toolbar
android:id="@+id/playlistAB"
style="?xenoActionBarTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/chwytak"
android:elevation="4dp"
android:minHeight="?attr/actionBarSize">

<Spinner
android:id="@+id/spinner_toolbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.v7.widget.Toolbar>

<RelativeLayout
android:id="@+id/wypelniacz"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:background="?xenoPanelBackgroundColor"/>

<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_above="@id/wypelniacz"
android:layout_below="@id/playlistAB"
android:background="?xenoPanelBackgroundColor"/>
</RelativeLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

</FrameLayout>

最佳答案

您可以在 list 中使用 windowSoftInputMode 属性作为示例

 <activity
android:windowSoftInputMode="adjustPan"
android:name=".YourActivity"></activity>

Activity 的主窗口如何与包含屏幕软键盘的窗口交互。此属性的设置会影响两件事:当 Activity 成为用户关注的焦点时,软键盘的状态——无论是隐藏还是可见。对 Activity 的主窗口所做的调整 — 是否将其调整得更小以便为软键盘腾出空间,或者当窗口的一部分被软键盘覆盖时是否平移其内容以使当前焦点可见。

在这里您可以获得更多信息 https://developer.android.com/guide/topics/manifest/activity-element.html

您可以根据自己的需求获取合适的属性

关于android - 启用调整大小或滚动键盘弹出的 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43865963/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com