Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在键盘打开android时只按滚动视图_Android - Fatal编程技术网

在键盘打开android时只按滚动视图

在键盘打开android时只按滚动视图,android,Android,嗨,我有一个包含3个视图的活动 -RelativeLayout ---TextView 1) ---ScrollView 2) -----FrameLayout ---------ListView ---------EditText -----------> When I click over here (2) view only pushup ---TextView 3) 我只想要2),即当键盘

嗨,我有一个包含3个视图的活动

-RelativeLayout
---TextView                 1)
---ScrollView               2)
-----FrameLayout
---------ListView
---------EditText -----------> When I click over here (2) view only pushup
---TextView                 3)
我只想要2),即当键盘打开时,滚动视图应该向上推,但现在它也推TextView 3)

我在梅尼费斯特试过

android:windowSoftInputMode="adjustNothing"
or
android:windowSoftInputMode="adjustResize" 
or
android:windowSoftInputMode="adjustPan" 

但是什么也没发生,3)文本视图也会按2)滚动视图打开软键盘减少可用屏幕空间,但不会改变文本视图位于屏幕底部的事实

因此,如果我理解正确,您希望在打开键盘时不显示文本视图吗

如果是这样,您可以尝试使用此方法捕获软键盘的显示/隐藏,并显示/隐藏Textview

编辑
还可以尝试在滚动视图上使用
android:isScrollContainer=“false”
android:windowSoftInputMode=“adjustNothing”
android:windowSoftInputMode=“adjustPan”
检测键盘是否显示隐藏文本视图,然后不显示

这是一段代码

_Your_Text_View.getViewTreeObserver().addOnGlobalLayoutListener(
            new OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    Rect r = new Rect();
                    // r will be populated with the coordinates of your view
                    // that area still visible.
                    activityRootView.getWindowVisibleDisplayFrame(r);
                    heightDiff = activityRootView.getRootView()
                                .getHeight() - (r.bottom - r.top);


                if (heightDiff > 100) { // if more than100 pixels, its
                            // probably a keyboard...

                    //here hide your TextView
                }else{

                         //here Show your TextView
                }
            });
在你的menifest中也写下这段代码

android:windowSoftInputMode="stateHidden|adjustPan"

伙计们,我也遇到了同样的问题,并通过一个非常方便和简单的解决方案获得了庇护,该解决方案涉及在驻留在xml文件中的Scrollview标记中添加一个属性。就是

android:isScrollContainer="false"

这将使底部布局位于键盘上。希望它能解决这个问题。

嘿!我也有同样的问题。你找到解决方案了吗?@Apurva no bro仍然没有:(如果你找到任何解决方案,那么请告诉我如何在一个框架布局中有两个视图?我认为一个框架布局只能包含一个视图。你能将
3)
与底部对齐吗?你尝试过吗?@siddhpuramit没问题,,:)应该是,尽管它可能取决于目标api(我自己还没有在较新的API上测试过它),但自己测试也不难:)