地方观看顶部和两种观点之间 [英] Place view on top and between two views

查看:147
本文介绍了地方观看顶部和两种观点之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图找出解决这个小问题。

Trying to figure out to overcome this little problem.

下面,左边是,我试图实现对应用程序的视图的样本。在右侧的是,我结束了这样的观点。

Below, on the left side, is a sample of the view that I'm trying to implement for an app. On the right side is the view that I'm ending up with.

在我的XML模拟了,我已经决定要使用 RelativeLayout的,但我不能让的TextView 顶部和底部视图之间为中心。

In my xml mock up I've decided to use a RelativeLayout but I can't get the TextView to be centered between the top and bottom views.

有关参考,这里是我的xml code的重新presenation:

For reference here's a represenation of my xml code:

 <RelativeLayout 
    android:layout_width:"match_parent"
    android:layout_height:"wrap_content">
    <ImageView
        android:id="@+id/BlackImage"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scaleType="centerCrop"
        android:layout_alightParentTop="true"
        android:layout_centerHorizontal="true"/>
    <ImageView
        android:id="@+id/RedImage"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scaleType="centerCrop"
        android:layout_below="@+id/BlackImage"
        android:layout_centerHorizontal="true"/>
    <TextView
        android:id="@+id/TextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/BlackImage"
        android:layout_centerHorizontal="true"/>
 </RelativeLayout>

任何想法,我缺少,或如何改变来获得我想要什么?

Any idea what I'm missing, or how to change to get what I want?

推荐答案

试试下面链接希望它会帮助你: -

try below link hope it will help you :-

TextView的上述布局图像视图

<一个href=\"http://stackoverflow.com/questions/15976292/android-listview-item-display-text-over-image-using-array-adapter\">Android使用阵列适配器上的图像列表视图项显示文本

如何把图像视图下的文本

 <?xml version="1.0" encoding="utf-8"?> 
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" android:background="@drawable/tmp" >


        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/uph" 
             android:layout_marginTop="-10dp"/>

        <RelativeLayout  android:layout_width="match_parent"
            android:layout_height="wrap_content" 
            android:layout_gravity="top|center">

            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/propfile" 
            />

           <TextView  android:layout_width="wrap_content"
               android:layout_height="wrap_content" 
               android:text="text" 
               android:layout_centerInParent="true"
           /> 
      </RelativeLayout>   
    </LinearLayout>

这篇关于地方观看顶部和两种观点之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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