大佬教程收集整理的这篇文章主要介绍了android – 当我在上面放一个长文本时,按钮向下移动,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的布局.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://scheR_476_11845@as.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <include android:id="@+id/include1" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" layout="@layout/action_bar" /> <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="top" android:padding="8dip" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" > <Button android:id="@+id/button1" android:layout_width="150dip" android:layout_height="150dip" android:text="This is a short text" /> <Button android:id="@+id/button2" android:layout_width="150dip" android:layout_height="150dip" android:text="This is a long text to show how the button is moved when it has a long text on it" /> </TableRow> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <Button android:id="@+id/button3" android:layout_width="150dip" android:layout_height="150dip" android:text="Button" /> <Button android:id="@+id/button4" android:layout_width="150dip" android:layout_height="150dip" android:text="Button" /> </LinearLayout> </LinearLayout> </ScrollView>
baselineAligned
为true,因此向下移动按钮以使文本位于同一基线上.将LinearLayout上的值设置为false可解决问题.
android:baselineAligned="false"
以上是大佬教程为你收集整理的android – 当我在上面放一个长文本时,按钮向下移动全部内容,希望文章能够帮你解决android – 当我在上面放一个长文本时,按钮向下移动所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。