KeyboardView icon indicating copy to clipboard operation
KeyboardView copied to clipboard

Key label with more than one character does not show

Open ugirishm opened this issue 3 years ago • 13 comments

Hi,

If we add key label with more than one character it won't show in the UI.

Thanks, Girish

ugirishm avatar May 19 '21 12:05 ugirishm

Hi @ugirishm, please try my example, there are two buttons Back and Fin which more than one character, you can check that.

hijamoya avatar May 21 '21 09:05 hijamoya

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 avatar May 21 '21 13:05 ugirishm

@ugirishm can you share your code?

hijamoya avatar May 22 '21 09:05 hijamoya

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

adil9d avatar May 24 '21 10:05 adil9d

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

grobbo91 avatar Jul 02 '21 04:07 grobbo91

It was my fault. Popup is working fine. My mistake.

adil9d avatar Jul 06 '21 04:07 adil9d

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.

grobbo91 avatar Jul 06 '21 06:07 grobbo91

@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>

DineshNeupane avatar Jul 07 '21 07:07 DineshNeupane

Fixed the previewLayout. But not able to fix minikeyboard popup. @grobbo91 How did you manage to do it?

DineshNeupane avatar Jul 07 '21 13:07 DineshNeupane

@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

adil9d avatar Jul 08 '21 04:07 adil9d

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

adil9d avatar Sep 23 '21 12:09 adil9d

@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" />

adil9d avatar Sep 23 '21 12:09 adil9d

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.

ChentaoZhou avatar Jan 20 '22 13:01 ChentaoZhou