Codename one latest build issue with fonts? - java

I am trying to do a build for android on codenameone , after the last update when I send a build for android it converts all buttons and label text to UPPERCASE
whatever the text [was written in]
any build hint or fix to this issue
Regards,

See this for the long version https://www.codenameone.com/blog/pixel-perfect-material-buttons.html
Here is the short version, you can disable this using:
myButton.setCapsText(false);
Button.setCapsTextDefault(false);
Define the theme constant capsButtonTextBool to false

According to the latest Material Design guidelines, buttons use ALL CAPS for text, regardless of the capitalization you pass in.
https://material.io/guidelines/components/buttons.html#buttons-style
To prevent this, set this attribute on your <Button> tag:
android:textAllCaps="false"

Try this ,
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAllCaps="false"
android:text="#string/button" />

Related

Android Studio: Enable EditText direct multiline input

When i build my application in android studio and test it on my phone, the edit text doesn't behave like a text editor and creates a popup input field above the keyboard and waits for you to press done. What I want to achieve is to behave like a text editor and get direct input from the keyboard without pressing done every time you want to add something.
I have tried everything in terms of xml attributes. I even searched how other text editor apps achieve the direct input, but with no avail, the popup field that gets the input and waits for you to press done didn't disappear. Here is my xml code for the edit text:
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/code_edit_text"
android:scrollbars="vertical"
android:inputType="textMultiLine"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:lines="16"
android:gravity="top|left"
android:maxLines="10000"
android:singleLine="false"/>
I think its better to try after removing
android:background="#drawable/code_edit_text"
android:scrollbars="vertical"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
these lines

How do I make an Android SeekBar?

I need an bar as like as image.
User can pull it and change value.
I need xml or java code for android studio.
You are looking for a SeekBar
Here's a XML code
<SeekBar
android:id="#+id/simpleSeekBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
Any opdates? I hope my answer helped you

How to underline an EditText

I am having some problems to underline an EditText in AndroidStudio.
This is what I am looking for (this is just a photo, not my real text):
But I do not really know any property to do that.
My code right now is really simple. Just the "normal" one:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:layout_margin="16dp"
android:id="#+id/tx_titulo"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="#string/pt_titulo"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:allowUndo="true"
/>
I do not want to underline just the text (in this case "Título"), but the whole PlainText
Does anybody know it?
Greets.
It is default, but try to check your styles. Maybe there is a style that will override the style in the whole application. If there is, just remove it
To do this programatically, you could find an answer in this post.
To set the underline color:
editText.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);
To remove the underline color:
editText.getBackground().clearColorFilter();
To do it from the XML, you could add background property to do the same thing in your layout.xml with any drawable resource as a background by adding:
android:background="#drawable/mydrawable"
If you have a couple of EditText with the same style configuration, to avoid setting the attribute to each EditText, you could override EditText's default attributes, defining a custom style like it is done here.

android - XML-created and Code-created checkboxes are different

I'm creating checkboxes in 2 diffent ways:
1) XML
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-10dp"
android:id="#+id/checkBox1" />
2) Java-code
CheckBox myCheckBox = new CheckBox(this);
myLayout.addView(myCheckBox);
And the look differently
The one from code:
And from XML:
Why is that?
And how can I make them equal?
I think it could be because the XML version is newer whereas the Java version draws an older version of a checkbox from an older android. I would suggest just using either Java or Xml for both. Keep them the same

Textview android:scrollHorizontally restarting on configuration change

I have the following Textview:
<TextView
android:id="#+id/detailsText"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Long text Long text Long text Long text Long text Long text "
android:textAppearance="?android:attr/textAppearanceLarge"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"
android:scrollHorizontally="true" />
The text is automatically scrolling from right to left (which is what I'm looking for) but after a configuration change the text restart scrolling from the beginning. I have tried to use android:configChanges="orientation|keyboardHidden|screenSize" and handle the configuration change in my code but this is not working. I also find out that this technique is not advised anymore, and tried to use Fragments instead, but nothing is working. I tried also to find out which value scrollHorizontally is modifying to do it's scrolling so I can try to save and restore it, but I never find it (textview.getScrollX() always stay at 0 for example).
I also noticed that this "scrolling restart" also happen when I use the textview.setVisibility(View.GONE); and textview.setVisibility(View.VISIBLE); methods.
Thanks for the help.

Categories

Resources