Formatting TextField formatting (add-on) in Titanium Android

I ran into the problem of formatting a plain text box in Titanium Android.

Problem . I can’t see the entered text box input value. If I print logs, their input will be entered, but will not be visible. On some devices, I get a piece of text.

Below is my code:

In my .js file, I have a text box as follows:

var t1 = Titanium.UI.createTextField({
        value : Titanium.App.Properties.getString("userID"),
        left : 130,
        top : 25,
        height : 30,
        width : 140,
        color : 'black',
        font : {
            fontSize : 12
        },
        borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
    });

In my tiapp.xml file:

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <application android:theme="@style/Theme.Titanium"/>
        <supports-screens android:anyDensity="false"
            android:largeScreens="false"
            android:normalScreens="false" android:resizeable="false"
            android:smallScreens="false" android:xlargeScreens="false"/>
    </manifest>
</android>

The solution has been verified . I tried the solution indicated in the link:

, TextField " Ti.UI.SIZE" + <supports-screens android:anyDensity="true"/> tiapp.xml + <property name="ti.ui.defaultunit">dp</property> tiapp.xml.

"Ti.UI.SIZE", , , , .

.

.

: Android 4.4.4 5.0 OS. .

+4
1

, mytheme.xml, platform folder--> android folder --> res folder--> values folder --> mytheme.xml

mytheme.xml:

 <?xml version="1.0" encoding="utf-8"?>
    <resources>
    <!-- Define a theme using the AppCompat.Light theme as a base theme -->
    <style name="Theme.MyTheme" parent="@style/Theme.Titanium">
    <!-- For Titanium SDK 3.2.x and earlier, use the Holo.Light or Light theme
    <style name="Theme.MyTheme" parent="@android:style/Theme.Holo.Light">
    -->
        <item name="android:editTextStyle">@style/editText</item>
    </style>

    <style name="editText" parent="@android:style/Widget.EditText">
        <item name="android:textCursorDrawable">@null</item>   
        <item name="android:textColor">#000000</item>
        <item name="android:paddingLeft">10dp</item>
        <item name="android:paddingRight">10dp</item>
        <item name="android:background">#FFFFFF</item>
        <item name="android:gravity">center_vertical</item>
        <item name="android:layout_width">wrap_content</item>
    </style>
</resources>

tiapp.xml:

android:

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <application android:theme="@style/Theme.MyTheme"/>
</manifest>
</android>

+4

All Articles