<RelativeLayout>
<LinearLayout
android:id="@+id/f1">
<EditText
android:id="@+id/f1textA"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
<EditText
android:id="@+id/f1textB"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout>
<LinearLayout
android:id="@+id/f2">
...
</LinearLayout>
</RelativeLayout>
如何在f1textA上onFocus时隐藏f2 LinearLayout,并将f1设置为全屏。当lostFocus在f1textA上时,显示f2,并且f1保持原始高度。 (用于隐藏/显示自定义键盘)
答案 0 :(得分:0)
试试这个,
f1textA.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
//Hide f2 linear layout and show f1 linear layout
} else{
//show f1 linear layout and show f2 linear layout
}
}
});