Push view above when using custom Keyboard

巧了我就是萌 提交于 2019-12-07 12:18:14

问题


I have created a custom keyboard for my android application. I have also disabled the default android keyboard. I display the keyboard as a fragment in the activity and it shows up well.

I only cannot get activity view to push above when the keyboard shows up. Is there any way that I could do this?

XML FILE

<FrameLayout
        android:id="@+id/flKeyboard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" />

SHOW FRAGMENT

FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.add(R.id.flKeyboard, new Keyboard()).commit();

回答1:


You can try something like this:

<RelativeLayout>  
<View
    android:id="@+id/myView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
 />  
<FrameLayout
        android:id="@+id/flKeyboard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/myView"
/>

</RelativeLayout>



回答2:


I'm not sure if this is the correct way, but I've used a translate animation, to move the view along the Y-axis. With some tweaking , it actually looks better than the default android push.



来源:https://stackoverflow.com/questions/23672433/push-view-above-when-using-custom-keyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!