KeyboardView
KeyboardView copied to clipboard
Key label with more than one character does not show
Hi,
If we add key label with more than one character it won't show in the UI.
Thanks, Girish
Hi @ugirishm, please try my example, there are two buttons Back and Fin which more than one character, you can check that.
Hi @hijamoya, I ran your example and it works fine. However, I am using the java version in my project and not the kotlin version. Can you build an example in java and check if it works fine?
The work around I have implemented is to either create a svg file and add it in resources, and use it as an icon or create a drawable with text programatically and use it as icon.
@ugirishm can you share your code?
android:popupLayout="@xml/keyboard_popup"
This attributes not working what I do now? When I was using deprecated it was working fine now it crashed on null object reference
Hi, I am having this issue as well. Having a label with more than one character renders blank. The correct text/code is still output however. I even converted all my java (except keyboardView0.0.3) to Kotlin and I am still having issues with rendering keysLabels more than character long. I did not believe it was a Kotlin thing at first, decided to convert to Kotlin regardless but the issue is still open.
Things I have tried:
- make labels significantly wider and taller
- both unicode escapes and the actual text
- get rid of attributes I had in my XML that were not in the example (horizontalGap and verticalGap)
EDIT: I fixed this eventually, I think the main thing I did was making sure each instance of KeyboardView was changed to the com.hijamoya.keyboardView, there was one hidden instance I was previously unaware of
It was my fault. Popup is working fine. My mistake.
It was my fault. Popup is working fine. My mistake.
Do you know how you fixed it? I will try harder to resolve tomorrow then close this issue.
@adil9d can you post some code, how you solve the issue? I was setting custom layout to keyPreviewLayout but it doesnot seem to work. <item name="keyPreviewLayout">@layout/preview_layout</item>
Fixed the previewLayout. But not able to fix minikeyboard popup. @grobbo91 How did you manage to do it?
@DineshNeupane I faced this problem my mistake is I did not use style please use style properly. If you want in mini keyboard make a custom style for that. If keys text or label did not show use app:keyTextSize="20sp" app:labelTextSize="20sp" . And use app space in external keys xml. Your all problem will solve
First Theme should be correct secondly u have to proper use of name space e.g android:text or app:text If your design is fine you are making mistakes in name space
@DineshNeupane @grobbo91 This Style and XML working perfectly. ///// Style
/////////XML Code
<com.scope.keyboardpractice.Keyboard.Services.LatinKeypadView_leading xmlns:tools="http://schemas.android.com/tools" android:id="@+id/keyboard1" style="@style/KeyboardView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_row="@android:integer/config_longAnimTime" android:adjustViewBounds="true" android:alpha="1" android:background="#00FFFFFF" android:clickable="true" android:focusable="true" android:focusableInTouchMode="true" android:imeOptions="actionSearch" android:inputType="textShortMessage" android:keyPreviewOffset="-12dp" android:paddingStart="@dimen/_2sdp" android:paddingTop="@dimen/_8sdp" android:paddingEnd="@dimen/_3sdp" android:paddingBottom="@dimen/_12sdp" app:keyBackground="@drawable/key_main" app:keyTextColor="@color/white" app:keyTextSize="20sp" app:labelTextSize="18sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" />
EDIT: I fixed this eventually, I think the main thing I did was making sure each instance of KeyboardView was changed to the com.hijamoya.keyboardView, there was one hidden instance I was previously unaware of
@grobbo91 I meet the same question, I have checked the KeyboardView references and I think all of them had been modified correctly. However it still renders blank when having a label with more than one character. If this one hidden instance related to Key or Keyboard class? Could you share more details about how you solve this question? Thx !
EDIT: Problem solved ! In my case, the attribute: 'app:labelTextSize' should be set within KeyboradView xml block.