如何在IME中使视图浮于其他视图之上?
|
我正在尝试在屏幕中间的IME“浮动”中创建一个ListView,就像Swype键盘一样:
我已经阅读了如何通过使用FrameLayout在活动中执行此操作,但是在我的IME(它不是服务,而是服务)中无法正常工作。我的输入视图由一个FrameLayout作为根视图,一个包含多个控件的子RelativeLayout和一个ListView组成,后者也是FrameLayout的子级。这是我的布局代码:
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
android:layout_gravity=\"bottom\"
android:gravity=\"center_horizontal\" >
<!-- Most of the controls are children of this RelativeLayout -->
<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
android:gravity=\"center\" >
<Button android:id=\"@+id/btnOption1\"
android:layout_width=\"wrap_content\"
android:layout_height=\"wrap_content\"
android:layout_marginRight=\"10dp\"
android:layout_alignParentLeft=\"true\"
android:layout_toLeftOf=\"@+id/imgArrow\"
android:layout_marginTop=\"10dp\"
android:textSize=\"18dp\"
android:textColor=\"#ffffff\"
android:background=\"@drawable/button\"
android:padding=\"4dp\"
android:text=\"Option 1\" />
<ImageView android:id=\"@id/imgArrow\"
android:layout_width=\"wrap_content\"
android:layout_height=\"wrap_content\"
android:layout_marginRight=\"10dp\"
android:layout_centerHorizontal=\"true\"
android:layout_alignBottom=\"@id/btnOption1\"
android:layout_marginTop=\"10dp\"
android:padding=\"4dp\"
android:src=\"@drawable/arrow_right\" />
<Button android:id=\"@+id/btnOption2\"
android:layout_width=\"wrap_content\"
android:layout_height=\"wrap_content\"
android:layout_alignParentRight=\"true\"
android:layout_toRightOf=\"@id/imgArrow\"
android:layout_marginTop=\"10dp\"
android:textSize=\"18dp\"
android:textColor=\"#ffffff\"
android:background=\"@drawable/button\"
android:padding=\"4dp\"
android:text=\"Option 2\" />
<!-- Translate button -->
<Button android:id=\"@+id/btnContinue\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
android:layout_centerHorizontal=\"true\"
android:layout_below=\"@id/imgArrow\"
android:layout_marginTop=\"10dp\"
android:layout_marginBottom=\"10dp\"
android:textSize=\"22dp\"
android:textColor=\"#ffffff\"
android:background=\"@drawable/button\"
android:text=\"Translate!\" />
<!-- Keyboard button -->
<ImageButton android:id=\"@+id/btnKeyboard\"
android:layout_width=\"wrap_content\"
android:layout_height=\"wrap_content\"
android:layout_alignParentLeft=\"true\"
android:layout_below=\"@id/btnContinue\"
android:layout_marginRight=\"4dp\"
android:textColor=\"#ffffff\"
android:background=\"@drawable/button\"
android:src=\"@drawable/sym_keyboard_kb\" />
<!-- Undo button -->
<ImageButton android:id=\"@+id/btnUndo\"
android:layout_width=\"wrap_content\"
android:layout_height=\"wrap_content\"
android:layout_alignParentRight=\"true\"
android:layout_below=\"@id/btnContinue\"
android:textColor=\"#ffffff\"
android:background=\"@drawable/button\"
android:src=\"@drawable/sym_keyboard_undo\" />
</RelativeLayout>
<ListView android:id=\"@+id/menuOptions\"
style=\"@style/optionsMenu\" />
</FrameLayout>
ListView和IME如下所示(在SMS应用程序内部):
但我希望它看起来像这样:
换句话说,我希望它显示在IME输入视图之外。如果Swype可以做到,我知道我可以(在一点帮助下)。有什么建议么?
提前致谢!
巴里
没有找到相关结果
已邀请:
1 个回复
车料