简体   繁体   English

XML绝对布局将图像放在左下角和右下角

[英]XML Absolute Layout put image in Bottom Left and Bottom Right

Hello I want to make one application in which i am using Absolute layout and in that layout i am using two images i want to put one image in bottom left and another in bottom right can you help me how can i do this with xml or with java 您好,我想制作一个应用程序,在其中我使用绝对布局,在该布局中我使用两个图像,我想在左下角放置一个图像,在右下角放置另一个图像,您能帮我如何使用xml或爪哇

My code is 我的代码是

  <AbsoluteLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:layout_marginLeft="60dp"
android:layout_marginBottom="60dp"
android:id="@+id/mainLayout">
 <ImageView android:id="@+id/img1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/hk1" />
  <ImageView android:id="@+id/imgDel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/kitty"
         android:layout_gravity="left"
         />
 <ImageView android:id="@+id/imgIcon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/delete"
        android:layout_gravity="right"
         />

 </AbsoluteLayout>

use some thing like this 用这样的东西

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ImageView
        android:id="@+id/big_image"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/bigimage"/>
    <ImageView
        android:id="@+id/little_image"
        android:layout_width="50dip"
        android:layout_height="50dip"
        android:layout_alignRight="@id/big_image"
        android:layout_alignBottom="@id/big_image"
        android:src="@drawable/littleimage"/>
</RelativeLayout>

refered from relative layout aligning images about right bottom corner 相对布局中引用有关右下角的对齐图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM