Place view on top and between two views

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. <img src="https://i.stack.imgur.com/EIFhT.png" alt="Container">

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.

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 above Image view in a layout

Android listview item display text over image using array adapter

how to put text under image view

<?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>


  • PyException: ImportError: No module named domreg
  • How To Pause A SurfaceView Thread From An Android Activity
  • how add and delete rows to table layout in java programically
  • Custom Spinner TextView is being cut off
  • View disappears after setting height of gridLayout to wrap_content
  • TextView shadow not showing up in preview - although working on real device
  • Edittext requestFocus() dynamically not working
  • adMob | Extend Banner size?
  • Can I override some attribute of drawable shape?
  • Close button for AdMob banner
  • Overlapping ImageView in RelativeView
  • Android custom dialog linearlayout size same as dialogs bg image
  • Android : Strike out Text with bold or thicker line than default STRIKE_THRU_TEXT_FLAG
  • Background image crashes android
  • Android how to set a transparent image resource of a view? or Remove the image?
  • How to automatically pop-up keyboard?
  • Float Label hint (TextInputLayout) not works with Android Data Binding
  • Android Custom dialog inflating from layout - alignment issue
  • How to get a android ListView item selector to use state_pressed
  • EditText ignores the ImeActionLabel
  • Toolbar shifts up, when soft keyboard appears
  • Picasso Taking time to load images
  • Gray line inside cardview :)?
  • How Lists (specifically, RecyclerView with CardViews) in Android work
  • Android fill_parent issue
  • How to set my toolbar fixed while scrolling android
  • log4net write single file for each call to log.info
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • Trying to get generic when generic is not available
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • embed rChart in Markdown
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • How can I remove ASP.NET Designer.cs files?
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Android Heatmap on canvas or ImageView
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal