#android
#Android
Вопрос:
У меня есть текст для редактирования внутри плавающего пузыря.
Все они запускаются из моего сервиса bubble:
...
import com.siddharthks.bubbles.FloatingBubbleConfig;
import com.siddharthks.bubbles.FloatingBubbleService;
public class BubbleService extends FloatingBubbleService {
RecyclerView rcView;
RecyclerViewAdapter adapter;
ArrayList<Definition> list1;
View view;
EditText txt_Definition;
TextView txt_WordType, txt_Pronounciation;
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
@SuppressLint("ResourceType")
@Override
protected FloatingBubbleConfig getConfig() {
FloatingBubbleConfig.Builder b = new FloatingBubbleConfig.Builder();
b.bubbleIcon(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_add))
.removeBubbleIcon(ContextCompat.getDrawable(getApplicationContext(), com.siddharthks.bubbles.R.drawable.close_default_icon))
.bubbleIconDp(54)
.expandableView(getView())
.removeBubbleIconDp(54)
.paddingDp(4)
.borderRadiusDp(0)
.physicsEnabled(true)
.expandableColor(Color.WHITE)
.triangleColor(0xFF215A64)
.gravity(Gravity.LEFT);
initDataTest();
return b.build();
}
представление, которое я передаю в «expandableView ()» :
private View getView() {
LayoutInflater inflater = getInflater();
view = inflater.inflate(R.layout.bubble_layout, null);
txt_Definition = view.findViewById(R.id.txt_Definition1);
txt_WordType = view.findViewById(R.id.txtWordType);
rcView = view.findViewById(R.id.reCyclerView_List);
txt_Pronounciation = view.findViewById(R.id.txt_Pronunciation);
ImageView speaker = view.findViewById(R.id.img_speaker);
txt_Definition.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
InputMethodManager m = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
m.showSoftInput(txt_Definition,InputMethodManager.SHOW_FORCED);
}
}
});
return view;
}
Весь текст редактирования в этом пузырьке может быть сфокусирован, но клавиатура не отображается.
Я пытался :
android:focusableInTouchMode="true"
android:windowSoftInputMode="adjustResize"
и:
holder.editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
InputMethodManager m = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
m.showSoftInput(holder.editText,InputMethodManager.SHOW_FORCED);
}
}
});
но нет надежды. Кто-нибудь может мне помочь!
Вот полный исходный код: GITHUB