JAVA代码:
mEdtTextPickup.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
mLayoutDrop.invalidate();
mEdtTextPickup.bringToFront();
}
}
});
mEdtTextDrop.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
mLayoutPickup.invalidate();
mEdtTextDrop.bringToFront();
}
}
});
` 我在我的应用程序Source和Destination中有两个布局,其中一个布局在FrameLayout中与另一个重叠。(就像附加图像一样)
现在,如何在聚焦时将目标布局置于动画源布局之上。我google了很多,但没有找到解决方案。
答案 0 :(得分:0)
You can use a focus change listener to identify when the field is focused and then bringToFront to bring the view above the others.
destinationEditText.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
edittext.bringToFront();
}
}
});