2017-06-21 80 views
1

如何处理webview中的滚动,以便当光标到达某一行的下方时,光标会自动在其上方滚动。是否有任何功能,因为它可以由IO处理,但我没有找到任何东西的机器人。Android webview滚动问题

+0

添加了webview的示例代码。所以这将很容易帮助 –

+0

@ Vinayaga: - 我已经导入这个库: - https://github.com/wasabeef/richeditor-android/。在这里,只要光标在键盘下面,它就会移动到键盘上方,但现在我添加了一些水平线,比如说键盘上方10dp的高度。但光标隐藏在该栏后面。我如何处理它 – ritwik

回答

0

我很高兴我可以帮你解决这个问题!

解决方案非常简单!我正在使用同一个丰富的编辑器。

我正面临同样的问题,我解决它删除ScrollView

你需要做的是在你的布局上创建一个线性布局,并在其中放置编辑器。只有一件事你应该包括如线性布局标签:

android:windowSoftInputMode="adjustPan|adjustResize" 

这是我的布局(注:我改变了控制的名称)

<LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scrollbars="vertical" 
      android:layout_marginLeft="15dp" 
      android:layout_marginRight="15dp" 
      android:layout_marginTop="15dp" 
      android:layout_marginBottom="115dp" 
      android:windowSoftInputMode="adjustPan|adjustResize" 
      android:background="@drawable/background_container_corner_white" 
      android:layout_alignParentTop="true"> 

      <com.glaucioleonardo.wcmauditor.activities.editor.RichEditor 
       android:id="@+id/editor" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_margin="5dp"/> 

</LinearLayout> 

你并不需要使用线性布局中的这些标签。我只是用它们根据我的应用程序格式

android:layout_marginLeft="15dp" 
android:layout_marginRight="15dp" 
android:layout_marginTop="15dp" 
android:layout_marginBottom="115dp" 
android:background="@drawable/background_container_corner_white" 
android:layout_alignParentTop="true" 

现在它的工作完美!如果你没有解决你的问题,请发布你的布局,并会更容易帮助你!