久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

向 EditText 字段添加陰影效果

Add drop shadow effects to EditText Field(向 EditText 字段添加陰影效果)
本文介紹了向 EditText 字段添加陰影效果的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我正在嘗試設(shè)計(jì)一個(gè)具有像這樣的陰影(底部和右側(cè))的 EditText 字段

I am trying to design an EditText Field having Shadows (bottom and right side) like this

嘗試谷歌搜索和搜索了很多 SO 討論,但都是針對(duì) TextView 而不是 EditText.

tried googling & hunted many SO discussions but all are for TextView not EditText.

這是我在輸入文本中添加陰影而不是在文本字段中添加陰影的代碼

This is my code adding shadow to Input Text but not to TextField

<EditText android:id="@+id/txtpin" 
        android:maxLength="4" 
        android:layout_marginLeft="10dp" 
        android:layout_height="37dp" 
        android:gravity="center_horizontal" 
        android:inputType="textPassword" 
        android:longClickable="false" 
        android:layout_width="160dp" 

        android:shadowColor="@color/Black"
        android:shadowDx="1.2"
        android:shadowDy="1.2"
        android:shadowRadius="1.5" 

        android:background="@color/White">
            <requestFocus></requestFocus>
        </EditText>

<小時(shí)>

我猜它需要一些可繪制的自定義 xml 視圖,但沒(méi)有得到確切的想法.實(shí)現(xiàn)這一目標(biāo)的邏輯是什么.


I guess it needs some custom xml view in drawable but not getting exact idea. What will be the logic to achieve this.

任何幫助將不勝感激.

推薦答案

嗯.. @Shalini 的回答以這種方式幫助了我,但我仍然有另一種方法可以使用 EditText Field 實(shí)現(xiàn) 2D 陰影,我將與您分享.

Well.. @Shalini's answer helped me in this way but still I got another way to achieve 2D shadow with EditText Field and I am going to share with you.

我們需要為 EditText 創(chuàng)建具有三層的自定義 XML 視圖,底部陰影和右側(cè)陰影

We need to create custom XML view with three layer for EditText, bottom shadow and right side shadow

下面是我的代碼.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<!-- most important is order of layers -->

    <!-- Bottom right side 2dp Shadow -->
    <item >
        <shape android:shape="rectangle">
            <solid android:color="#000000" />           
        </shape>
    </item>

    <!-- Bottom 2dp Shadow -->
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#000000" />   
        </shape>
    </item>

    <!-- White Top color -->
    <item android:bottom="3px" android:right="3px">
        <shape android:shape="rectangle">
            <solid android:color="#FFFFFF" />           
        </shape>
    </item> 
</layer-list>

<小時(shí)>

現(xiàn)在我們可以使用Background"屬性將此陰影視圖設(shè)置為我們的 TextField


Now we can set this shadow view to our TextField using "Background" property

喜歡這個(gè)

<EditText android:layout_width="wrap_content" 
            android:id="@+id/txtpin"  
            android:maxLength="4" 
            android:layout_height="37dp" 
            android:gravity="center_horizontal" 
            android:longClickable="false" 
            android:padding="2dp"

            android:inputType="textPassword|number" 
            android:password="true" 
            android:background="@drawable/edittext_shadow" 
            android:layout_weight="0.98" 
            android:layout_marginLeft="15dp">
                <requestFocus></requestFocus>
   </EditText>

<小時(shí)>

結(jié)果屏幕就像我在上面發(fā)布的問(wèn)題一樣.


and the result screen is like I have posted in question above.

感謝 SO,分享知識(shí).

Thanks to SO, sharing knowledge.

這篇關(guān)于向 EditText 字段添加陰影效果的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標(biāo)簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測(cè)向左或向右滑動(dòng)?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉(zhuǎn)對(duì)話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點(diǎn)擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設(shè)置為僅接受 Android 中的數(shù)值?)
主站蜘蛛池模板: 久久亚洲欧美日韩精品专区 | 特级a欧美做爰片毛片 | a级黄色网 | 国产性网 | 久久aⅴ乱码一区二区三区 亚洲欧美综合精品另类天天更新 | 国产精品视频入口 | 精品欧美黑人一区二区三区 | 成人性生交大片 | 一区二区免费 | v片网站| 美国十次成人欧美色导视频 | 一区二区精品在线 | 日韩一级免费看 | 日韩精品一区二区三区中文在线 | 久热久热| 午夜精品一区二区三区免费视频 | 91精品久久久久久久久久入口 | 久久三级影院 | 亚洲欧美一区二区三区在线 | 81精品国产乱码久久久久久 | 欧美国产日韩在线观看 | sese视频在线观看 | 日韩乱码av| 久久这里只有精品首页 | av日韩在线播放 | 一级片在线观看 | 免费人成激情视频在线观看冫 | 欧美a区 | 久久久久国产一区二区三区四区 | 精品国产一二三区 | 国产免费一区二区 | 在线观看视频你懂得 | 国内精品久久精品 | 在线视频第一页 | 日韩综合在线 | 欧美日本一区 | 国产不卡一区 | 亚洲最大av| 久久久夜 | 欧美成人不卡 | 欧美日韩一区二区在线 |