开发者

Android: what's the layout when an IME is active?

Maybe some background: I'm trying to have a specific keyboard-view visible above a scrollable full-screen EditText when the user clicks it. The problem is that if the cursor is at the bottom of the EditText it is hidden by the popped up keyboard-view.

The obvious difference to the regular IME-view is that the IME-view pushes the EditText to the top and lets the user scroll the entire EditText in that top area. The keyboard-view sits at the bottom. Everything is visible and accessible. That's what I want to achieve with my pop-up, too.

Therefore, my question is: what does the layout look like when a regular IME is visible? I don't need the animation (if it's hard to do I can skip that part).

I tried to loop through the layout-hierarchy to see what's different. Here's it with IME visible:

root: com.android.internal.policy.impl.PhoneWindow$DecorView
  android.widget.LinearLayout
    android.widget.FrameLayout
      android.widget.TextView
    android.widget.FrameLayout               #1
      android.widget.RelativeLayout
       开发者_StackOverflow中文版 android.widget.ScrollView
          android.widget.EditText
        com.mytest.KeyboardView

Here it is without the IME and my pop-up view visible:

root: com.android.internal.policy.impl.PhoneWindow$DecorView
  android.widget.LinearLayout
    android.widget.FrameLayout
      android.widget.TextView
    android.widget.FrameLayout               #1
      android.widget.RelativeLayout
        android.widget.ScrollView
          android.widget.EditText
        com.mytest.KeyboardView

Obviously, there's no difference. Is the IME really missing?

For easier understanding I marked my app with "#1", so the RelativeLayout is the root-element in my XML-layout.

Can anyone please help me? If somebody has an XML-style layout ready, I'd be more than happy to see it.

Update

By now I believe that I was wrong in thinking that the IME-view would put itself into the layout-hierarchy of the activity.

In the meantime I was trying to make a PopupWindow work, but couldn't come up with something that would fix the problem with the hidden cursor in the EditText.

Therefore, let me ask this: how does the IME-view appear or how is it woven into the overall display? How does it scroll itself below the editing field and moves the editing field up and makes it scroll the way it does?


It seems that the IME is not reachable. Or at least it's not accessible in any way by the app.

I now have a rather static view of my EditText and the keyboard. The keyboard doesn't hover into screen nor does it any other fancy stuff. It's mounted below the EditText. That's it. It doesn't look spectacular or anything, but we here agreed that the user probably won't enter long stories.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜