在 LinearLayout 中对齐 ImageButton 时出现问题?
这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:background="@drawable/game_background"
android:weightSum="100"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView android:id="@+id/ScrollView01" android:layout_weight="70"
android:layout_width="fill_parent" android:layout_height="228dp">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="30px" android:id="@+id/LinearLayout02"
android:orientation="vertical">
<TextView android:layout_height="wrap_content" android:text="Version 0.0.0.1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content" android:textColor="#000000"></TextView>
<TextView
android:text="Thanks for trying out the very first version of this program!\n\n"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000"></TextView>
<ImageButton android:id="@+id/imageButton1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:src="@drawable/prefs_exit" android:onClick="exit_button"
android:background="#00000000"></ImageButton>
</LinearLayout>
</ScrollView>
<LinearLayout android:layout_width="fill_parent" android:layout_weight="30"
android:layout_height="fill_parent" android:id="@+id/LinearLayout02"
android:orientation="vertical">
<ImageButton android:id="@+id/imageButton1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:src="@drawable/prefs_exit" android:onClick="exit_button"
android:background="#00000000"></ImageButton>
</LinearLayout>
</LinearLayout>
问题是第二个 LinearLayout 中的图像按钮位于屏幕的右侧而不是底部:(
我该如何解决这个问题?
最后,我想在上面放置一个图形(徽标)总底部,右角
注意,我是一个新手,仍然在学习这个......只是通过示例迷失了
谢谢! 瑞安
This is my code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:background="@drawable/game_background"
android:weightSum="100"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView android:id="@+id/ScrollView01" android:layout_weight="70"
android:layout_width="fill_parent" android:layout_height="228dp">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="30px" android:id="@+id/LinearLayout02"
android:orientation="vertical">
<TextView android:layout_height="wrap_content" android:text="Version 0.0.0.1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content" android:textColor="#000000"></TextView>
<TextView
android:text="Thanks for trying out the very first version of this program!\n\n"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000"></TextView>
<ImageButton android:id="@+id/imageButton1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:src="@drawable/prefs_exit" android:onClick="exit_button"
android:background="#00000000"></ImageButton>
</LinearLayout>
</ScrollView>
<LinearLayout android:layout_width="fill_parent" android:layout_weight="30"
android:layout_height="fill_parent" android:id="@+id/LinearLayout02"
android:orientation="vertical">
<ImageButton android:id="@+id/imageButton1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:src="@drawable/prefs_exit" android:onClick="exit_button"
android:background="#00000000"></ImageButton>
</LinearLayout>
</LinearLayout>
The problem is the image button in the second linearLayout comes on the right side of the screen instead of at the bottom :(
How do I fix this?
And finally, I want to put a graphic (a logo) on the total bottom, right corner side.
Note, I am a newbie and still very much learning this... just got lost via the examples.
Thanks!
Ryan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将
android:orientation="vertical"
添加到第一个 LinearLayoutUPDATE
至于右侧的徽标,尝试
android:gravity=第二个 LinearLayout 中的“right”
try adding
android:orientation="vertical"
to the first LinearLayoutUPDATE
as for logo to the right, try
android:gravity="right"
in your second LinearLayout这是正确的布局,只需检查它并用您的图像替换背景图像即可。享受开发应用程序的乐趣。
Here is your correct layout, just check it and just replace the background images with your images. Have fun developing applications.