安卓弹出软键盘怎么把一部分布局顶上去?

wangzaizhou 2017-03-31 09:52:48
我的界面底部有个edittext输入框,当我把activity的 android:windowSoftInputMode="adjustPan|stateHidden"设置时,软件盘弹出时,会把整个界面都顶上去,我的titlebar也被顶上去了,很难看,有什么办法把标题栏以下的顶上去,标题栏不用顶上去,谢谢。
...全文
2237 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
yj523325 2017-11-21
  • 打赏
  • 举报
回复
为什么我用了回复中的嵌套scrollview没用呢
ganshenml 2017-05-26
  • 打赏
  • 举报
回复
引用 6 楼 qq_35660577 的回复:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <include
        android:id="@+id/include1"
         layout="@layout/title_bar" />

    

        <ScrollView 
            android:id="@+id/scrollView2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

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


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

                    <EditText
                        android:id="@+id/ed_dealplan"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="10dp"
                        android:layout_marginRight="10dp"
                        android:hint="请输入"
                        android:textSize="15sp" />
                </LinearLayout>
         
      </LinearLayout>
        </ScrollView>

</LinearLayout>
把 EditText放在ScrollView中,然后把ScrollView放在Titlebar下,清单文件的activity中加入 android:windowSoftInputMode="stateAlwaysHidden"
用LinearLayout就可以了,如果改用RelativeLayout,则是连Toolbar一起被顶起的。
wangzaizhou 2017-05-25
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <include
        android:id="@+id/include1"
         layout="@layout/title_bar" />

    

        <ScrollView 
            android:id="@+id/scrollView2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

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


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

                    <EditText
                        android:id="@+id/ed_dealplan"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="10dp"
                        android:layout_marginRight="10dp"
                        android:hint="请输入"
                        android:textSize="15sp" />
                </LinearLayout>
         
      </LinearLayout>
        </ScrollView>

</LinearLayout>
把 EditText放在ScrollView中,然后把ScrollView放在Titlebar下,清单文件的activity中加入 android:windowSoftInputMode="stateAlwaysHidden"
wangzaizhou 2017-05-21
  • 打赏
  • 举报
回复
引用 3 楼 fairy_z的回复:
怎么解决的 能分享下经验?
嗯,好的
wangzaizhou 2017-05-21
  • 打赏
  • 举报
回复
引用 2 楼 ESC尛蜜蜂的回复:
用scrollview嵌套下,,解决就好,最好能把你解决方法写出来
嗯,好的
大漠烽火狼 2017-04-17
  • 打赏
  • 举报
回复
怎么解决的 能分享下经验?
wangzaizhou 2017-03-31
  • 打赏
  • 举报
回复
我曹,自己解决了。
ESC尛蜜蜂 2017-03-31
  • 打赏
  • 举报
回复
用scrollview嵌套下,,解决就好,最好能把你解决方法写出来

80,348

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧