comment ajouter un effet d'ombre sur le drawable dans android
J'ai créé bulle de chat avec drawable qui a l'air bien, maintenant, je veux ajouter un effet d'ombre en dessous de la drawable il faire de l'effet 3d.Je ne veux pas utiliser 9-hauteur de l'image. Je veux juste savoir comment je peux ajouter un effet d'ombre sur cette drawable. mon code est
----right_bubble_chat_drawable
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="15dp" />
<solid android:color="@color/chatrightbubbleColor" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
<size
android:height="@dimen/normal_button_height"
android:width="@dimen/normal_button_width" />
--- pour coin de pointeur 'chat_laftarraow'
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item >
<rotate
android:fromDegrees="90"
android:toDegrees="-90"
android:pivotX="50%"
android:pivotY="50%" >
<rotate
android:fromDegrees="45"
android:toDegrees="45"
android:pivotX="-40%"
android:pivotY="86%" >
<shape
android:shape="rectangle" >
<stroke android:color="#00aaef" android:width="1dp"/>
<solid
android:color="#00aaef" />
</shape>
</rotate>
</rotate>
</item>
</layer-list>
------- Je les utilise comme
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<View
android:id="@+id/left_chatArror"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_marginTop="6dp"
android:background="@drawable/chat_laftarraow"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="220dp"
android:layout_marginRight="-3dp"
android:orientation="horizontal"
android:layout_toLeftOf="@+id/left_chatArror"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:background="@drawable/right_bubble_chat_drawable">
</RelativeLayout>
</RelativeLayout>
Veuillez me suggérer comment puis-je ajouter un effet d'ombre en dessous de la bulle comme dans l'image ci-dessous
OriginalL'auteur maddy d | 2014-10-14
Vous devez vous connecter pour publier un commentaire.
Vous pouvez essayer par la mise en œuvre d'une couche-liste qui sera la toile de fond pour le LinearLayout et ajouter votre
view
à l'intérieur de ce.Citation de la réponse à cette question:
MODIFIER
Vous pouvez créer seprate xml pour la création de gris de l'image comme thsis:
----right_bubble_shdw_chat_drawable
--- pour coin de pointeur 'chat_laftarraow_shdw'
------- Je les utilise comme
faire de différentes
layer-list
code et ajoutez simplement<solid android:color="@android:color/darker_gray" />
à l'intérieur de votre code couleurJe ne comprends pas, pouvez-vous donner quelques exemple de code ou de.
Dans votre
right_bubble_chat_drawable
xml au lieu de<solid android:color="@color/chatrightbubbleColor" />
utilisation<solid android:color="@android:color/darker_gray" />
et de même que dans les ` chat_laftarraow" où jamais vous utilisezandroid:color
seprate xml pour l'ombre et en ajouter un autre, utiliser les mêmes que pour votre bulleil n'a pas travaillé.
OriginalL'auteur Himanshu Agarwal