背景图像隐藏了Android应用程序中的所有按钮
在我的应用程序中,我试图显示两个按钮和一个标题栏,上面有标题文本。这些都与背景图像一起放置。但我只能看到背景图像和其他按钮、标题栏和文本。以下是我的活动布局。
这里我将背景 imageView id 表示为 bgd。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView android:id="@+id/bgd"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:src="@drawable/startingpage">
</ImageView>
<LinearLayout android:id="@+id/linearLayout1"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<ImageView android:id="@+id/title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/applicationbar">
</ImageView>
<TextView android:id="@+id/titletext"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="2dip"
android:layout_gravity="center"
android:layout_marginLeft="80dip">
</TextView>
</LinearLayout>
<ImageButton android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dip"
android:layout_marginLeft="20dip"
android:id="@+id/add"
android:src="@drawable/addrestingspot">
</ImageButton>
<ImageButton android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:layout_marginLeft="20dip"
android:id="@+id/search"
android:src="@drawable/search">
</ImageButton>
</LinearLayout>
请告诉我哪里错了......
in my app i am trying to show two buttons and an a title bar with a title text over it. these all are been placed along with a background image. But i am able to see only the background image and the other buttons, title bar and text. Following is the layout of my activity.
here i have denoted the background imageView id as bgd.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView android:id="@+id/bgd"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:src="@drawable/startingpage">
</ImageView>
<LinearLayout android:id="@+id/linearLayout1"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<ImageView android:id="@+id/title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/applicationbar">
</ImageView>
<TextView android:id="@+id/titletext"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="2dip"
android:layout_gravity="center"
android:layout_marginLeft="80dip">
</TextView>
</LinearLayout>
<ImageButton android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dip"
android:layout_marginLeft="20dip"
android:id="@+id/add"
android:src="@drawable/addrestingspot">
</ImageButton>
<ImageButton android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:layout_marginLeft="20dip"
android:id="@+id/search"
android:src="@drawable/search">
</ImageButton>
</LinearLayout>
please tell me where i am going wrong.....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您的 ImageView 正在“吃掉”所有空间并将其余元素推到底部。由于您没有滚动条,因此您看不到它们。您应该在第一个 LinearLayout(顶层)中使用背景图像。类似于:
对于第一个布局应该可以解决问题
I think your ImageView is "eating" all the space and pushing the rest of the elements to the bottom. Since you don't have a scrollbar you can't see them. You should use the Background Image in the first LinearLayout (the top level one). Something like:
For the first layout should do the trick