2017-02-17 7 views
-3

Hallo Leute, ich denke an ein bestimmtes Design, das ich in meiner Android-App implementieren möchte, aber es ist sehr schwierig für mich, mit einem Weg zu kommen, es hier zu tun, was ich bin Auf der Suche nach.How to custom design android Text bearbeiten

was ich suche: enter image description here

<LinearLayout 
    android:background="#C5CAE9" 
    android:layout_width="match_parent" 
    android:layout_height="30dp" 
    android:orientation="horizontal"> 

    <android.support.design.widget.TextInputLayout 
     android:padding="5dp" 
     android:layout_width="0dp" 
     android:layout_weight="1" 
     android:background="#3F51B5" 
     android:layout_height="match_parent"> 

     <android.support.design.widget.TextInputEditText 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/form_username"/> 

`

+1

Welcher Teil schwierig ist? – bc004346

Antwort

1

Sie können neun-Patch verwenden, um dies zu tun. NinePatch-Bilder sind PNG-Bilder, auf denen Sie Zonen angeben können, in denen Text erlaubt oder abgelehnt wird. So können Sie Ihr gewünschtes Bild (mit Ihren Symbolen) entwerfen und den Text auf den Teilen der Symbole verweigern. Wenn Sie fertig sind, legen Sie das Bild als Hintergrund fest. In Android Studio gibt es dafür ein nützliches WYSIWIG-Tool. Für weitere Informationen schauen Sie bitte here

0

ich so etwas sagen würde:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="horizontal" 
android:layout_width="100dp" 
android:layout_height="wrap_content" 
android:background="@drawable/your_background_with_orange_stroke"> 

<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:src="@drawable/your_left_one_drawable"/> 

<android.support.design.widget.TextInputLayout 
    android:padding="5dp" 
    android:layout_width="0dp" 
    android:layout_weight="1" 
    android:background="#3F51B5" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.TextInputEditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="@string/form_username"/> 
<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:src="@drawable/your_right_pen_drawable"/> 

0

Versuchen und lassen Sie sehen, ob dies ist, was Sie wollen.

erstellen ziehbar shape.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle"> 
    <corners android:radius="50dp" /> <-- change it to your need radius 
    <stroke android:width="3px" android:color="@color/chocolate" /> 
    <solid android:color="@color/grey"/> 
</shape> 

erstellen Layout

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="15dp"> 

    <EditText 
      android:id="@+id/keyword" 
      android:layout_width="match_parent" 
      android:layout_height="50dp" 
      android:hint="Type keyword..." 
      android:padding="15dp" 
      android:textSize="16sp" 
      android:inputType="textPersonName" 
      android:background="@drawable/shape"/> 

    <ImageView 
      android:id="@+id/icon" 
      android:layout_width="50dp" 
      android:layout_height="50dp" 
      android:padding="10dp" 
      android:tint="@color/chocolate" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentEnd="true" 
      android:src="@drawable/icon_calendar"/> 
</RelativeLayout>