正如你可以看到我的文本所有大写属性没有勾选,我的设计工具窗口显示小写文本但我的模拟器没有。我的手机也发生了同样的事情。请帮忙。
这是我的xml代码: activity_main.xml中:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.ishansrivastava.a01_06_05_displaying_images_again.MainActivity">
<include
layout="@layout/reusable_layout"
android:layout_width="0dp"
android:layout_height="83dp"
tools:layout_constraintTop_creator="1"
tools:layout_constraintRight_creator="1"
android:layout_marginStart="3dp"
android:layout_marginEnd="3dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="3dp"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
app:layout_constraintHorizontal_bias="0.0"
android:id="@+id/include" />
<ImageView
android:id="@+id/imageView"
android:layout_width="366dp"
android:layout_height="304dp"
app:srcCompat="@drawable/levels"
tools:layout_constraintRight_creator="1"
tools:layout_constraintBottom_creator="1"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginEnd="8dp"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintLeft_creator="1"
android:layout_marginBottom="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
app:layout_constraintHorizontal_bias="0.0" />
<TextView
android:id="@+id/textView"
android:layout_width="158dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:gravity="fill_vertical|center_horizontal"
android:text="Plain"
android:textSize="18sp"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1"
app:layout_constraintBottom_toBottomOf="@+id/webView"
android:layout_marginTop="15dp"
app:layout_constraintTop_toBottomOf="@+id/include"
android:layout_marginBottom="14dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp" />
<Button
android:id="@+id/button2"
android:layout_width="155dp"
android:layout_height="53dp"
android:layout_marginEnd="13dp"
android:layout_marginRight="13dp"
android:layout_marginTop="2dp"
android:onClick="onButton2Click"
android:text="Search the Web"
app:layout_constraintRight_toRightOf="@+id/include"
app:layout_constraintTop_toBottomOf="@+id/include"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"
tools:textAllCaps="false" />
<WebView
android:id="@+id/webView"
android:layout_width="0dp"
android:layout_height="35dp"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"
app:layout_constraintRight_toRightOf="@+id/button2"
android:layout_marginTop="9dp"
app:layout_constraintTop_toBottomOf="@+id/button2"
app:layout_constraintLeft_toLeftOf="@+id/button2" />
</android.support.constraint.ConstraintLayout>
reusable_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="368dp"
android:layout_height="495dp"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp"
tools:showIn="@layout/content_main">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Pepperoni" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Extra Cheese" />
</LinearLayout>
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onButtonClick"
android:text="Show Image"
tools:textAllCaps="false" />
</LinearLayout>
答案 0 :(得分:1)
tools:textAllCaps="false" change this in to android:textAllCaps="false"
如需其他评论,请查看
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:buttonStyle">@style/Button</item>
</style>
<style name="Button" parent="Widget.AppCompat.Button">
<item name="android:textAllCaps">false</item>
</style>
按钮文字可能会被适用于所有按钮的应用主题转换为大写。检查主题/样式文件以设置属性android:textAllCaps。
答案 1 :(得分:0)
在按钮中尝试此操作
android:textAllCaps="false"
如果它不起作用而不是尝试这个我的朋友而不是这个
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:buttonStyle">@style/Button</item>
</style>
<style name="Button" parent="Widget.AppCompat.Button">
<item name="android:textAllCaps">false</item>
</style>