Android自定义输入法:layout_alignParentBottom使输入区域填满屏幕的大部分

Android自定义输入法:layout_alignParentBottom使输入区域填满屏幕的大部分,android,android-input-method,Android,Android Input Method,我创建了一个自定义输入方法,可以动态更改布局。我想将最后一个视图与输入区域的底部对齐。我为最后一个视图设置了layout_alignParentBottom属性,但是输入区域会扩展到几乎整个屏幕,如图所示 不带布局(下集) 布局与底部设置对齐 我有一个android:windowBackground样式集,但即使没有它,它也能做同样的事情。我在onCreateInputView中的自定义InputMethodService类中展开XML布局,并且在MyClass的onFinishInfl

我创建了一个自定义输入方法,可以动态更改布局。我想将最后一个视图与输入区域的底部对齐。我为最后一个视图设置了layout_alignParentBottom属性,但是输入区域会扩展到几乎整个屏幕,如图所示

不带布局(下集)

布局与底部设置对齐

我有一个android:windowBackground样式集,但即使没有它,它也能做同样的事情。我在onCreateInputView中的自定义InputMethodService类中展开XML布局,并且在MyClass的onFinishInflate方法中不调整任何布局设置。这是我的密码。有什么想法吗

my_class_layout.xml MyClass.java MyClassInputMethodService.java 编辑 我为windowBackground drawable尝试了一个较小尺寸的图像,它确实使默认输入法区域变小了

<style name="Theme.Blue" >
    <item name="android:windowBackground">@drawable/background_blue</item>
</style>

这就引出了另一种可能性。我是否必须使用尽可能最小的背景图像大小,以适应将要显示的最少数量的视图,或者我是否可以使windowBackground可绘制动态,以便它只使用与输入法视图相同的高度

你能发布com.package.MyClass代码吗?我用基本代码添加了相关类,并确保问题仍然存在。尝试为MyClass视图设置固定高度android:layout\u height=100dpI尝试避免硬编码尺寸,但在这种情况下可能是必要的?或者创建较小的背景图像
package com.package;

<imports>

public class MyClass extends RelativeLayout {
private final MyClassInputMethodService mInputMethodServiceContext;
private Button mLoginButton;

public MyClass(Context context, AttributeSet attrs) {
    super(context, attrs);
    mInputMethodServiceContext = (MyClassInputMethodService)context;
}

public MyClass( MyClassInputMethodService context ) {
    super(context);
    mInputMethodServiceContext = (MyClassInputMethodService)context;
}

@Override
protected void onFinishInflate() {

    // Login button
    mLoginButton = (Button)findViewById(R.id.login_button);
}
package com.package;

<imports> 

public class MyClassInputMethodService extends InputMethodService {

private static final String TAG = MyClassInputMethodService.class.getSimpleName();

private static MyClassInputMethodService mContext;
private View mInputView;

@Override
public void onCreate() {

// Set Theme
setTheme(UserManagement.getCurrentUser().getTheme().getResourceId());
super.onCreate();
mContext = this;
}

@Override
public View onCreateInputView() {
     mInputView = (MyClassLogin) getLayoutInflater().inflate(R.layout.fast_fill_login, null);
    return mInputView;
}

}
<style name="Theme.Blue" >
    <item name="android:windowBackground">@drawable/background_blue</item>
</style>