2014-09-09 2 views
0

picОбработка backgournd макета

Привет, В картинке выше форме стрелки изображение на фоне является TextView. В то время как фон всего макета выполняется с использованием формы. Но я хочу, чтобы точка стрелки выглядела так, как показано ниже. Может кто-нибудь мне помочь в этом.

pic2

<TextView android:id="@+id/timestamp" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Button" 
    android:textColor="#808080" 
    android:layout_centerHorizontal="true" 


    android:layout_marginTop="5dp" 
    android:layout_marginLeft="15dp" 

    /> 


    <RelativeLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/background" 
    android:layout_marginTop="30dp" 
    android:layout_marginLeft="20dp" 
    > 

<TextView android:id="@+id/btn" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Button" 
    android:textColor="#FFFFFF" 
    android:background="@drawable/xyz" 
    android:layout_marginLeft="-10dp" 
    android:paddingRight="15dp" 
    android:paddingLeft="15dp" 

    /> 

<TextView 
    android:id="@+id/firsttv" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/hello_world" 
    android:layout_toRightOf="@+id/btn" 
    android:layout_alignBottom="@+id/btn" 
    android:maxLines="1" 
    android:layout_marginRight="80dp" 
    /> 

<TextView 
    android:id="@+id/sectv" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/hello_world" 
    android:layout_below="@+id/btn" 
    android:layout_marginRight="30dp" 
    android:layout_marginLeft="45dp" 

    /> 
</RelativeLayout> 
    </RelativeLayout> 
+0

Можете ли вы показать некоторый код, который используется для генерации этого? –

+0

См. Edit plz –

+0

Добавьте 'android: layout_marginLeft =" - 25dp "в ваш вид btn. Измените значение до тех пор, пока не получите желаемый эффект. –

ответ

1

Вот пример того, что вы пытаетесь достичь.

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 
    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="50dp" 
     android:layout_marginTop="30dp" 
     android:layout_marginLeft="20dp" 
     android:id="@+id/relativeLayout"> 

     <TextView 
      android:id="@+id/firsttv" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/hello_world" 
      android:maxLines="1" 
      android:layout_alignParentBottom="true" 
      android:layout_alignLeft="@+id/sectv" 
      android:layout_alignStart="@+id/sectv"/> 

     <TextView 
      android:id="@+id/sectv" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/hello_world" 
      android:layout_marginRight="30dp" 
      android:layout_marginLeft="50dp" 

      /> 
    </RelativeLayout> 

    <TextView android:id="@+id/btn" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Button" 
       android:textColor="#FFFFFF" 
       android:paddingRight="15dp" 
       android:paddingLeft="15dp" 
       android:layout_alignTop="@+id/relativeLayout" 
       android:background="@drawable/xyz" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true"/> 
</RelativeLayout> 

Обратите внимание, что кнопка должна быть вне этого RelativeLayout в противном случае он будет croped

+0

да Это помогло с небольшими изменениями. –

Смежные вопросы