2

I am a little stuck on this. I have an ImageView and TextView, within a FrameLayout, and I am trying to make a customized banner with text over the ImageView. I cant seem to figure out how to make the textview diagonal and to the left or right. This is the closest thing I can find to express what I am trying to do (but with my own custom text):

enter image description here

Is there a simple/efficient way to go about doing this?

Here is my current xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ImageView
            android:id="@+id/icon"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#000000"
            android:ellipsize="none"
            android:text="TextView"
            android:textColor="#ffffff" />

    </FrameLayout>

</LinearLayout>

EDIT: Keep in mind I dont want to be able to change the text to whatever I want dynamically.

HAxxor
  • 1,164
  • 3
  • 16
  • 28
  • You can create this **SOLD OUT** as an image and use it, it can be done more easily. – Numair Aug 23 '12 at 18:47
  • I want to be able to dynamically change the text to whatever I want though. – HAxxor Aug 23 '12 at 18:50
  • What i think, with coloured background, you can add it in you res folders and change it whenever it is required. – Numair Aug 23 '12 at 18:58
  • Check out the answer here: http://stackoverflow.com/questions/24130238/how-to-display-an-imageview-slightly-outside-a-relativelayout-or-outside-the-scr – AllDayAmazing Aug 18 '16 at 06:29

1 Answers1

0

I suggest you take a look at ApiDemos sample project. You'll find there a sample, drawing text along the path. com.example.android.apis.graphics.TextAlign.java