appcelerator钛 - 我如何使按钮文字小写?

bha*_*ral 0 appcelerator

我知道无论出于什么原因谷歌决定让所有按钮文字都在棒棒糖中大写.

如何在我的appcelerator应用程序中设置它,我的所有按钮文本都不是大写,但只是我输入了它?

小智 6

您只需在/app/platform/android/res/values.xml下定义一个android值

<resources>
<style name="Theme.myTheme" parent="@style/Theme.AppCompat.NoActionBar">
    <item name="android:buttonStyle">@style/customButton</item>
</style>

<style name="customButton" parent="Widget.AppCompat.Button">
    <item name="android:textAllCaps">false</item>
</style>    
Run Code Online (Sandbox Code Playgroud)

将android主题添加到manifest(Theme.myTheme):

    <android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <supports-screens android:anyDensity="false"
            android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
        <uses-permission android:name="android.permission.CAMERA"/>
        <uses-feature android:name="android.hardware.camera"/>
        <uses-feature android:name="android.hardware.camera.autofocus"/>
        <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23"/>
        <application android:debuggable="true"
            android:icon="@drawable/appicon"
            android:largeHeap="true" android:theme="@style/Theme.myTheme">
            <activity
                android:configChanges="keyboardHidden|orientation|screenSize" android:name="org.appcelerator.titanium.TiActivity"/>
        </application>
    </manifest>
</android>
Run Code Online (Sandbox Code Playgroud)