Android studio에서 대소문자를 내릴 수 없습니다.
아까부터 저를 괴롭히던 사소한 질문이 있습니다.구글에 검색해 보았지만 저와 같은 문제가 있거나 문제로 보지 않는 사람은 없는 것 같습니다.activity_my.xml의 레이아웃 아래 버튼을 만들 때
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_1_name"
android:id="@+id/button2"
android:layout_marginTop="140dp"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true" />
버튼이 하나 잡혔어요.
내 스트링 코드가:
<resources>
<string name="app_name">HelloWorld</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="button_1_name">BuTtOn 1</string>
제가 여기서 작은 것을 놓치고 있는 것은 확실하지만, 버튼 텍스트에서 소문자/윗글이 작동하려면 어떻게 해야 합니까?
감사합니다!
추가할 수 있습니다.android:textAllCaps="false"
단추로
버튼 텍스트는 모든 버튼에 적용되는 앱의 테마에 따라 대문자로 변환될 수 있습니다.속성 설정을 위해 테마/스타일 파일 확인android:textAllCaps
.
<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>
activity_main.xml에서 보기 내부의 다음 코드를 사용하여 쉽게 수행할 수 있습니다.
android:textAllCaps="false"
고객님의 경우 다음과 같습니다.
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_1_name"
android:id="@+id/button2"
android:layout_marginTop="140dp"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true"
android:textAllCaps="false" />
스타일/themes.xml에 추가하여 앱의 모든 버튼에 대해 변경할 수도 있습니다.
<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>
mainActivity.kt 또는 mainActivity.java에서 다음을 사용하여 Programmatic으로 설정할 수도 있습니다.
Button btn = (Button) findViewById(R.id.button2);
btn.setAllCaps(false);
이는 응용 프로그램 코드에서 버튼의 TransformationMethod null을 설정하여 수정할 수 있습니다.
mButton.setTransformationMethod(null);
더하다android:textAllCaps="false"
xml button 이 문제는 사실입니다.
3가지 방법이 있습니다.
1.style.xml에 다음 행을 추가하여 전체 응용 프로그램을 변경합니다.
<item name="android:textAllCaps">false</item>
2.사용
android:textAllCaps="false"
당신의layout-v21
mButton.setTransformationMethod(null);
- xml의 요소(버튼 또는 텍스트 편집) 아래에 이 줄 추가)
안드로이드:textAllCaps="false"
안부 전해요
이렇게 설정할 수 있습니다.
button.setAllCaps(false);
계획적으로
단추 내의 .xml 파일에 이 줄을 추가합니다.
android:textAllCaps="false"
안드로이드에는 속성이 있습니다.textAllCaps="false"는 자신의 스몰과 캡에 원하는 캐릭터를 만드는 것입니다.기본적으로 True가 되었으므로 이 코드를 작성하고 텍스트를 작성합니다.AllCaps= false 그러면 필요에 따라 버튼에 텍스트를 작고 캡스 문자로 작성할 수 있습니다.우리의 요구에 따라 글자를 쓸 수 있는 버튼의 코드를 완성합니다.
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btnLogin"
android:text="Login for Chat"
android:textAllCaps="false"/>
XML 코드로
이 행을 추가합니다.android:textAllCaps="false"
벨로우 코드처럼
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_1_name"
android:id="@+id/button2"
android:layout_marginTop="140dp"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true"
** android:textAllCaps="false" ** />
아니면
자바 코드로 (프로그래밍 방식으로)
단추에 이 줄을 추가합니다.setAllCaps(false)
Button btn = (Button) findViewById(R.id.button2);
btn.setAllCaps(false);
TextView에서 이 문제에 직면했습니다.난 시도했다.
android:textAllCaps="false",
mbutton.setAllCaps(false);
<item name="android:textAllCaps">false</item>
그 중 어떤 것도 저에게 효과가 없었습니다.드디어 진절머리가 나서 코드화된 텍스트가 있는데, 효과가 있습니다.
tv.setText("Mytext");
TV는 TextView의 객체입니다.하지만 코딩 표준에 따르면, 그것은 나쁜 관행입니다.
XML: 안드로이드:textAllCaps="false"
프로그래밍 방식:
m단추모든 캡(허수)을 설정합니다.
언급URL : https://stackoverflow.com/questions/24880388/cannot-lower-case-button-text-in-android-studio
'sourcecode' 카테고리의 다른 글
쿼리를 하나의 레코드로 제한하면 성능이 향상됩니까? (0) | 2023.11.04 |
---|---|
jQuery.live()와 .on()의 차이점은 무엇입니까? (0) | 2023.11.04 |
이미 64비트 Oracle Database Server를 실행 중인 윈도우즈 Server에 Oracle 32비트 클라이언트 설치 (0) | 2023.11.04 |
char*str={"foo",...의 차이점은 무엇입니까?} 그리고 charstr[5]={"foo",...} 배열 정의? (0) | 2023.11.04 |
AngularJS - 경로를 기반으로 한 외부 JS의 동적 로딩 (0) | 2023.11.04 |