2016-06-24 2 views

Antwort

2

würde ich das Gradientenbild verwenden Sie in Ihrem ziehbar Ordner. Nennen wir es background.png. Sie können mit den Symbolen auch tun searchicon.png und arrow.png

Dann würde ich diesen Code verwenden:

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:padding="10dp" 
    android:background="@drawable/background"> 
    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:gravity="center_vertical"> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textColor="#ffffff" 
      android:layout_marginBottom="10dp" 
      android:text="Current Location"/> 
     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal"> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:textColor="#ffffff" 
       android:textSize="20dp" 
       android:text="Mumbai"/> 
      <ImageView 
       android:layout_width="20dp" 
       android:layout_height="20dp" 
       android:layout_marginLeft="20dp" 
       android:layout_marginStart="20dp" 
       android:src="@drawable/arrow"/> 
     </LinearLayout> 
    </LinearLayout> 
    <ImageView 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:layout_marginRight="50dp" 
     android:layout_marginEnd="50dp" 
     android:layout_centerVertical="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentEnd="true" 
     android:src="@drawable/searchicon"/> 
</RelativeLayout> 
0

Es ist nicht gut Ansatz tun es programmatisch Wetter Sie erhalten Sie führen durch XML-Design.

enter image description here

Verwandte Themen