我有一些个水平的LinearLayout排了几行按钮,平均分配宽度。但当按钮的文本较长出现换行时,就会出现对不齐的情况。如图:
请问需要设置什么属性才能解决?或者换用其他Layout也行
应该跟行数没关系,比如整个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="horizontal" >
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="短文本" />
<Button
android:text="长文本长文本"
其余同上/>
<Button
android:text="短文本"
其余同上 />
</LinearLayout>
我试过了,没有解决问题
我就是这种方法,结果就是图中的样子
追答4个水平布局都设置权重了吗?
追问都设了layout_weight=1
然后layout_width是match_parent
我说的权重是水平的LinearLayout要设置,你那不是只设置了按钮吗?
追问我试过了,应该不是那里的关系。
因为就算是只有一行也有这个问题。
那个文本不能传上来吗,我直接给你改,你只发一部分我还要敲其他的,很麻烦
追问长度限制不能直接贴,传了个网盘
http://pan.baidu.com/share/link?shareid=3337228165&uk=2667997032