試すandroid:windowSoftInputMode="adjustPan
追加機能付き
このような別のクラスを作成します
package com.example.customLayout;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
public class MyRelativeLayout extends RelativeLayout
{
private OnRelativeLayoutChangeListener layoutChangeListener;
public interface OnRelativeLayoutChangeListener
{
void onLayoutPushUp();
void onLayoutPushDown();
}
public MyRelativeLayout(Context context, AttributeSet attributeSet)
{
super(context, attributeSet);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
try
{
final int proposedheight = MeasureSpec.getSize(heightMeasureSpec);
final int actualHeight = getHeight();
if (actualHeight > proposedheight)
{
// Keyboard is shown
layoutChangeListener.onLayoutPushUp();
}
else if(actualHeight < proposedheight)
{
// Keyboard is hidden
layoutChangeListener.onLayoutPushDown();
}
}
catch (Exception e)
{
e.printStackTrace();
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
public void setLayoutChangeListener(OnRelativeLayoutChangeListener layoutChangeListener)
{
this.layoutChangeListener = layoutChangeListener;
}
public OnRelativeLayoutChangeListener getLayoutChangeListener()
{
return layoutChangeListener;
}
}
このクラスのカスタム ビューをレイアウト xml ファイルの親として作成します。
<com.example.customLayout.MyRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res/com.example.customLayout"
android:id="@+id/customRelativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
// your original layout file
</com.example.customLayout.MyRelativeLayout>
Javaファイルで次のコードを試してください
myRelativeLayout=(MyRelativeLayout)findViewById(R.int.customRelativeLayout);
myRelativeLayout.setLayoutChangeListener(new OnRelativeLayoutChangeListener() {
public void onLayoutPushUp()
{
Controller_Test1.tabWidget.setVisibility(View.GONE);
}
public void onLayoutPushDown()
{
Controller_Test1.tabWidget.setVisibility(View.VISIBLE);
}
});