动作条被隐藏当我使用安卓windowSoftInputMode =" adjustPan" [英] Actionbar gets hidden when i use android:windowSoftInputMode="adjustPan"

查看:119
本文介绍了动作条被隐藏当我使用安卓windowSoftInputMode =" adjustPan"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

清单

    <activity
        android:name="com.example.Thread"
        android:label="Thread"
        android:windowSoftInputMode="adjustPan"
        android:parentActivityName="com.example.Home" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.Home" />
    </activity>

布局XML文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e3e3e3"
android:orientation="vertical" >

<View
    android:id="@+id/view2"
    android:layout_width="match_parent"
    android:layout_height="4dp"
    android:background="@color/green_line" />

<RelativeLayout
    android:id="@+id/bottom_layout"
    android:layout_width="match_parent"
    android:layout_height="55dp"
    android:background="#f0eeec"
    android:layout_alignParentBottom="true" >

    <ImageView
        android:id="@+id/camera"
        android:layout_width="55dp"
        android:layout_height="55dp"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:padding="16dp"
        android:src="@drawable/camera" />

    <ImageView
        android:id="@+id/send"
        android:layout_width="55dp"
        android:layout_height="55dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:padding="12dp"
        android:src="@drawable/abc_ic_go_search_api_holo_light" />

    <EditText
        android:id="@+id/chatContent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@+id/send"
        android:layout_toRightOf="@+id/camera"
        android:ems="10" />

</RelativeLayout>

<ListView
    android:id="@+id/chatThread"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/bottom_layout"
    android:layout_below="@+id/view2"
    android:divider="@null"
    android:dividerHeight="0dp"
    android:layout_centerHorizontal="true" >

</ListView>

当用户调用softkeyboard它重叠列表视图以便底部项得到隐藏由相同。如果我给安卓windowSoftInputMode =adjustPan列表视图上升到键盘,但也隐藏动作条。

When the user invoke softkeyboard it is overlapping the listview so that the bottom items getting hidden by the same. if i give android:windowSoftInputMode="adjustPan" Listview going up to the keyboard but also hiding the actionbar.

我需要的列表视图上去,但动作条应该呆在那里在上面。我怎么能实现呢?请评论,如果需要更多的澄清。

I need the listview to go up but the ActionBar should stay there on top. How i can implement that? Please comment if need more clarification.

推荐答案

试试这个

 android:windowSoftInputMode="adjustResize"

和声明你的ListView像这样

and declare your listview like this

ListView listView = (ListView) findViewById(R.id.list_view);
listView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
listView.setStackFromBottom(true);

我希望这对你的工作和阅读<一个href="http://stackoverflow.com/questions/17410499/difference-between-adjustresize-and-adjustpan-in-android">this,它adjustPan和adjustResize的理解帮助

i hope this work for you and read this, it help in understanding of adjustPan and adjustResize

这篇关于动作条被隐藏当我使用安卓windowSoftInputMode =&QUOT; adjustPan&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆