Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – 如果我在键盘弹出时设置linearlayout重量,它会调整其大陆的大小大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
对此 example进行了操作并设法将fab按钮放在正确的位置

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

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

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

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

XML:

<android.support.design.widget.CoordinatorLayout    
xmlns:android="http://scheR_206_11845@as.android.com/apk/res/android"
xmlns:app="http://scheR_206_11845@as.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:BACkground="@color/white"
android:focusableInTouchMode="true">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
android: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>

@L_@R_696_11248@_5@

是因为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 – 如果我在键盘弹出时设置linearlayout重量,它会调整其大陆的大小全部内容,希望文章能够帮你解决android – 如果我在键盘弹出时设置linearlayout重量,它会调整其大陆的大小所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。