如何使用Android中的z-index [英] how to use z-index in android

查看:1428
本文介绍了如何使用Android中的z-index的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  <LinearLayout 
    android:orientation="vertical"
    android:layout_width="300dp"
    android:layout_height="50dp">
  <ImageView android:layout_height="40dp" android:id="@+id/imageView1" 
   android:background="@drawable/nicetab" 
   android:layout_width="300dp" ></ImageView>
    <TextView
        style="@style/DialogText.Title"
        android:id="@+id/title"
        android:paddingBottom="10dip"
        android:paddingLeft="45dip"
        android:paddingTop="7dip"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/codeFont" 
        android:textSize="15dip"
        />
</LinearLayout>

怎么可以把TextView的上ImageView的。有没有在android系统没有办法做到这一点,在HTML实在是太容易,我们用ARA z-index的,但在这里 - 不知道

How could I put TextView on ImageView. Is there any way in android to do this, in HTML it is too easy we ara using z-index, but here - no idea

推荐答案

一个非常简单的方法是使用一个 RelativeLayout的

A very simple way would be to use a RelativeLayout

<RelativeLayout 
    android:orientation="vertical"
    android:layout_width="300dp"
    android:layout_height="50dp" >
    <ImageView
        android:layout_height="40dp"
        android:id="@+id/imageView1"
        android:background="@drawable/nicetab"
        android:layout_width="300dp" />
    <TextView
        style="@style/DialogText.Title"
        android:id="@+id/title"
        android:paddingBottom="10dip"
        android:paddingLeft="45dip"
        android:paddingTop="7dip"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/codeFont" 
        android:textSize="15dip" />
</RelativeLayout>

这篇关于如何使用Android中的z-index的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆