中心对齐按钮的上左文本 [英] Center Aligned Button's Text on Left
本文介绍了中心对齐按钮的上左文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尽管我做了重心文本仍然左边。我认为必须有更改文本对齐的方法
(我曾尝试安卓textAlignment =中心太)
Even though I made gravity center text is still on left. I assume there must be a method to change text align (I have tried android:textAlignment="center" too)
我已经包括下面的截图,但没有足够的信誉,使显示它。
I've included screenshot below but dont have enough reputation to make show it.
<!-- language: lang-xml-->
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="50"
android:gravity="center"
android:text="Button" />
还试图使它仍然match_parent同样的问题。
also tried to make it match_parent still the same problem.
编辑整个XML
<!-- language: lang-xml-->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/etCommands"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Type a Command"
android:password="true" >
</EditText>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Button" />
</LinearLayout>
<TextView
android:id="@+id/tvResults"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="invalid" />
</LinearLayout>
推荐答案
我有这个问题了。只需重新启动IDE。
I had this problem too. Just restart your IDE.
这篇关于中心对齐按钮的上左文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文