开发者

backgroundimage is hiding all buttons in android app

开发者 https://www.devze.com 2023-02-28 01:38 出处:网络
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

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_wi开发者_StackOverflow中文版dth="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.....


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:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/startingpage"
    >

For the first layout should do the trick

0

精彩评论

暂无评论...
验证码 换一张
取 消