单击后按钮文本失去对齐
奇怪的事情发生了。我有一个 2x2 按钮表格布局,如下所示:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/cerca">
<TableRow
android:layout_width = "fill_parent"
android:layout_height = "wrap_content">
<Button
android:id = "@+id/btn1"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_weight="1"
android:text = "Scarica POI da server"
android:onClick="downloadFromServer"
/>
<Button
android:id = "@+id/btn2"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_weight="1"
android:text = "Aggiungi POI"
android:onClick="goCreatePOI"
/>
</TableRow>
<TableRow
android:layout_width = "fill_parent"
android:layout_height = "wrap_content">
<Button
android:id = "@+id/btn3"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_weight="1"
android:text = "Rimuovi i POI del server"
android:onClick="removeServerPOI"
/>
<Button
android:id = "@+id/btn4"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_weight="1"
android:text = "Rimuovi i POI personali"
android:onClick="removePersonalPOI"
/>
</TableRow>
</TableLayout>
该表格布局嵌套在相对布局内,该相对布局嵌套在滚动视图中。
现在,每当我单击其中之一时,每次按钮内的文本都会更改对齐方式:如果在单击之前居中并显示在两行上,则单击后它会失去对齐方式并仅显示在一行中(切断文本)。 我做错了什么,或者可能是一个错误?
Strange things happen. I have a 2x2 button table layout, which is the following:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/cerca">
<TableRow
android:layout_width = "fill_parent"
android:layout_height = "wrap_content">
<Button
android:id = "@+id/btn1"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_weight="1"
android:text = "Scarica POI da server"
android:onClick="downloadFromServer"
/>
<Button
android:id = "@+id/btn2"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_weight="1"
android:text = "Aggiungi POI"
android:onClick="goCreatePOI"
/>
</TableRow>
<TableRow
android:layout_width = "fill_parent"
android:layout_height = "wrap_content">
<Button
android:id = "@+id/btn3"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_weight="1"
android:text = "Rimuovi i POI del server"
android:onClick="removeServerPOI"
/>
<Button
android:id = "@+id/btn4"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_weight="1"
android:text = "Rimuovi i POI personali"
android:onClick="removePersonalPOI"
/>
</TableRow>
</TableLayout>
This table layout is nested inside a relative layout, which is nested in a scrollview.
Now, whenever i click on one of them, everytime the text inside the button change allignment: if before clicking was centered and displayed on two lines, after the click it loses its alignment and is displayed only in one row (cutting off some part of the text).
Am I doing something wrong, or maybe it's a bug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论