1

I have Tried these InputType but my issue not solve. My XML you can see. Please any suggestion.I extended softkeyboard class public class SoftKeyboard extends InputMethodService implements KeyboardView.OnKeyboardActionListener, SharedPreferences.OnSharedPreferenceChangeListener { – Thanks in advance.

<?xml version="1.0" encoding="utf-8"?>
<LatinKeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/urduSimple"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:alpha="1"
android:imeOptions="actionSearch"
android:inputType="textCapSentences"
android:keyBackground="@drawable/transparent_key_shape"
android:keyPreviewLayout="@layout/key_preview"
android:keyPreviewOffset="-4dp"
android:keyTextColor="@color/White"
android:paddingTop="4dp"
android:keyTextSize="28dp"
android:shadowRadius="0.0"
 android:popupLayout="@layout/keyboard_popup_layout">
 </LatinKeyboardView>
 Java:
            case InputType.TYPE_CLASS_TEXT:
            EditText editor = new EditText(this);
            editor.setInputType(InputType.TYPE_CLASS_TEXT | 
            InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
Ayan
  • 27
  • 5

1 Answers1

2

textCapSentences will work if user do not manually change the Softkeyboard to lower case. A normaly sentence ends with dot and a space after it.So it will perfectly work for this formate.

<EditText
    android:id="@+id/et"
    android:layout_width="match_parent"
    android:inputType="textCapSentences"
    android:layout_height="wrap_content" />

If user manually change the Keyboard then you should use a TextWatcher to formate the text again in sentence case.

ADM
  • 20,406
  • 11
  • 52
  • 83
  • thanks ADM i tried this solution but not solve my problem. – Ayan Dec 13 '17 at 05:46
  • In which device you are testing ? on what api level. Although i think this is not Api level dependent thing. – ADM Dec 13 '17 at 05:47
  • android version 4.4.2 Api Level 19 – Ayan Dec 13 '17 at 05:49
  • I am afraid that can be an issue. Kitkat and Kitkat MR are differ in some functions from the other android versions . So pls test with other api device other then Kitkat and KitkatMR. – ADM Dec 13 '17 at 05:51
  • thank you so much ADM for suggestion i tried on different device but still not solve. – Ayan Dec 13 '17 at 05:59
  • Do not post here . Edit the question – ADM Dec 13 '17 at 06:17
  • LatinKeyboardView extend EditText isn't it ? – ADM Dec 13 '17 at 06:28
  • You have customized the SoftKeyboard . You should have put this code in question at first place. – ADM Dec 13 '17 at 06:32
  • I have just tested it with android:inputType="textCapSentences" in edit text after removing key attributes and popuplayout . Its working as expected . – ADM Dec 13 '17 at 06:38