android– 如果我在键盘d出时设置linearlayout重量,它会调整其大陆的大小

android– 如果我在键盘d出时设置linearlayout重量,它会调整其大陆的大小,第1张

概述我对此example进行了 *** 作并设法将fab按钮放在正确的位置但当我按下编辑文本键盘d出时,它会混淆布局重量如何使ImageView成为静态,当键盘打开时,它将保持相同的大小?XML:<android.support.design.widget.CoordinatorLayoutxmlns:android="http://schemas.android.com/apk

我对此example进行了 *** 作并设法将fab按钮放在正确的位置

但当我按下编辑文本键盘d出时,它会混淆布局重量

如何使ImageVIEw成为静态,当键盘打开时,它将保持相同的大小?

XML:

<androID.support.design.Widget.CoordinatorLayout    xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:app="http://schemas.androID.com/apk/res-auto"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:background="@color/white"androID:focusableIntouchMode="true"><linearLayoutandroID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:orIEntation="vertical"><linearLayoutandroID:ID="@+ID/VIEwA"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:layout_weight="0.6"androID:background="@color/colorPrimary"androID:orIEntation="horizontal"><ImageVIEw    androID:ID="@+ID/imgvIEw"    androID:layout_wIDth="fill_parent"    androID:layout_height="match_parent"    androID:background="@color/light_blue"    androID:scaleType="centerCrop"    androID:src="@androID:drawable/ic_menu_camera"    androID:layout_gravity="top|center_horizontal"    /></linearLayout><linearLayout    androID:ID="@+ID/VIEwB"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:layout_weight="0.3"    androID:orIEntation="horizontal"></linearLayout></linearLayout><androID.support.design.Widget.floatingActionbutton    androID:ID="@+ID/add_image"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:layout_margin="@dimen/fab_margin"    app:layout_anchor="@ID/VIEwA"    androID:clickable="true"    app:layout_anchorGravity="bottom|right"    app:elevation="5dp"    app:pressedTranslationZ="0dp"    androID:src="@androID:drawable/ic_menu_camera"/></androID.support.design.Widget.CoordinatorLayout>

解决方法:

这是因为AndroID默认行为,视图将调整大小以便为键盘腾出空间.
您可以在清单文件中更新此内容
androID的可用值:windowsoftinputMode – > adjustResize,adjustPan,adjustUnspecifIEd

<application    androID:allowBackup="true"    androID:icon="@drawable/ic_launcher"    androID:label="@string/app_name"    androID:theme="@style/Apptheme" >    <activity        androID:name="com.example.MainActivity"        androID:label="@string/app_name"        androID:windowsoftinputMode="adjustPan" >        <intent-filter>            <action androID:name="androID.intent.action.MAIN" />            <category androID:name="androID.intent.category.LAUNCHER" />        </intent-filter>    </activity></application>

More info

总结

以上是内存溢出为你收集整理的android – 如果我在键盘d出时设置linearlayout重量,它会调整其大陆的大小全部内容,希望文章能够帮你解决android – 如果我在键盘d出时设置linearlayout重量,它会调整其大陆的大小所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1119466.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存