Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Android:软键盘推送整个布局,需要调整listview的大小大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个全屏聊天布局,我在顶部有一个带有徽标的标题,然后是一个包含所有聊天消息的listView,在底部我有editText和buttom来发送聊天消息.现在当我点击editText时会发生什么,整个布局被推高了.我需要的是,带有徽标的标题始终保持原样,并且listView可以调整大小.

这不是诀窍:

android:windowSofTinputMode="adjustResize"

这两个:

android:windowSofTinputMode="adjustPan"

也许是因我有全屏布局?

我需要找到一种不同的方法来调整我的listView一旦键盘存在,任何想法?提前致谢!

这是我的布局

<LinearLayout

    android:layout_width="match_parent"
    android:layout_height="70dp"
    android:BACkground="@drawable/ss99_yellow_area_navigation_bar"
    android:baselineAligned="false"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/BACk"
        android:layout_width="45dp"
        android:layout_height="match_parent"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="5dp"
        android:adjustViewBounds="true"
        android:clickable="true"
        android:src="@drawable/ss99_button_BACk" />

    <ImageView
        android:id="@+id/logo"
        android:layout_width="wrap_content"
        android:layout_height="75dp"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:src="@drawable/ss99_logo_small" />

</LinearLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="45dp"
    android:layout_marginTop="-2dp"
    android:BACkground="@drawable/ss9_yellow_bar_chat_new" >

    <TextView
        android:id="@+id/userOpponent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp"
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/userUser"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/userOpponent"
        android:layout_alignBottom="@+id/userOpponent"
        android:layout_alignParentright="true"
        android:layout_marginRight="5dp"
        android:text="Medium Text"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</RelativeLayout>

    <ListView
        android:id="@+id/chatList"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:ca@R_197_10943@olorHint="#00000000"
        android:divider="#00000000"
        android:list@R_489_10288@ctor="#00000000" 
     android:layout_weight="1"
      android:stackFromBottom="true"
        android:transcriptMode="alwaysScroll">
    </ListView>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:BACkground="@drawable/ss9_yellow_area_for_bottom_and_chat_String" >

           <ImageView
                    android:id="@+id/field1"
                    android:layout_width="220dp"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentTop="true"
                    android:layout_gravity="center"
                    android:layout_marginLeft="20dp"
                    android:layout_marginTop="10dp"
                    android:adjustViewBounds="true"
                    android:scaleType="centerInside"
                    android:src="@drawable/ss1_field_big" />

                <EditText
                    android:id="@+id/chatEdit"
                    android:layout_width="200dp"
                    android:layout_height="wrap_content"
                    android:layout_alignBottom="@+id/field1"
                    android:layout_alignLeft="@+id/field1"
                    android:layout_alignTop="@+id/field1"
                    android:layout_marginBottom="3dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="1dp"
                    android:BACkground="@null"
                    android:inputType="textAutoCorrect|textAutoComplete"
                    android:textAppearance="?android:attr/textAppearanceMedium" >

                </EditText>

    <ImageView
        android:id="@+id/chatOk"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_alignParentright="true"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="5dp"
        android:adjustViewBounds="false"
        android:baselineAlignBottom="false"
        android:clickable="true"
        android:croPTOPadding="false"
        android:scaleType="fitEnd"
        android:src="@drawable/ss4_button_go_small" />

    </RelativeLayout>

</LinearLayout>

解决方法

尝试将此添加到Manifest.xml中的活动
<activity
        android:windowSofTinputMode="stateVisible|adjustNothing">  
 </activity>

大佬总结

以上是大佬教程为你收集整理的Android:软键盘推送整个布局,需要调整listview的大小全部内容,希望文章能够帮你解决Android:软键盘推送整个布局,需要调整listview的大小所遇到的程序开发问题。

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

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