0

我有我的布局 xml 文件:

<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/relativeLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/screen_background">      


 <LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:layout_alignBottom="@+id/linearLayout01"
                android:layout_marginBottom="55dp">



<ImageView
                  android:id="@+id/imageView1"
                  android:layout_width="fill_parent"
                  android:layout_height="50dp"
                  android:src="@drawable/tone_movies_banner"
                  android:layout_alignParentTop="true"
                  android:scaleType="fitXY"/>

<GridView
    android:id="@+id/grid_view"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:numColumns="auto_fit"
    android:columnWidth="90dp"
    android:horizontalSpacing="10dp"
    android:verticalSpacing="10dp"
    android:gravity="center"
    android:stretchMode="columnWidth" >  

</GridView>

<LinearLayout
            android:id="@+id/linearLayout01"
            android:layout_width="fill_parent"
            android:layout_height="50dp"          
            android:layout_alignParentBottom="true"
            android:layout_marginBottom="5dp">
    </LinearLayout>

</LinearLayout>
</RelativeLayout>

我想在上面的布局 xml 文件中添加一个后退图像按钮?我在哪里可以添加此语句

<ImageButton
android:id="@+id/back_btn"
android:layout_width="30dp"
android:layout_height="190dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:background="@drawable/button_movielist_back"
/>

有人可以帮忙吗?

4

2 回答 2

1

它完全取决于你(你的设计,屏幕布局)它应该出现在哪里。目前看到您的布局,您可以将其添加到您的LinearLayout( id=linearLayout1 ) 上方。

另外,如果您可以降低后退按钮的高度,那就太好了。

android:layout_height="19dp" //instead of 190dp.
于 2013-03-26T04:45:32.877 回答
1

之后添加

<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/relativeLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/screen_background"> 




 <ImageButton
android:id="@+id/back_btn"
android:layout_width="30dp"
android:layout_height="190dp"
android:layout_alignParentLeft="true"
android:scaleType="fitXY"
android:layout_marginLeft="20dp"
android:background="@drawable/button_movielist_back"
/>

如果你想要它在屏幕的左上角

或替换android:layout_alignParentLeft="true"android:layout_alignParentRight="true"

如果你想要它在屏幕的右上角

后退按钮一般只在这两个位置找到。。

休息它纯粹是主观的,你发现它给你的应用程序一个漂亮的外观

于 2013-03-26T05:51:45.987 回答