2015-04-23 55 views
0

this is What I want, shadow is gradient的Android的EditText梯度陰影

我想這必須有一個漸變的陰影,如圖像所示的陰影,縮放圖像,看實際的漸變效果enter image description here

enter image description here

第二圖象是關於節目效果在變焦

+0

使用層列表繪製 – pskink

+0

沒有任何其他選擇? 因爲我需要使用10層,仍然不會完美 –

+0

10?我認爲3 ... – pskink

回答

0

所有我可以從圖片中看到 - 你應該使用EditText的每個[可繪製狀態] [可繪製的9層補丁陰影]。

+0

你有沒有任何例子來顯示@Artem –

+0

http://wptrafficanalyzer.in/blog/using-styles-and-themes-in- android/- 你必須閱讀,以獲得「選擇器」可繪製,用於默認,「沒有風格」EditText。然後 - 轉到你的「android-sdk」文件夾,找到相應平臺的選擇器文件(android-14,android-19等)。複製選擇器文件和所有提到的「@drawable」.png文件。分別爲所有dpi文件夾執行此操作。然後編輯所有的.png文件 - 添加您的自定義陰影。將選擇器引用到新的.png-s。將選擇器設置爲您的EditText(或從主題)的背景。就這樣。 –

+0

http://javatechig.com/android/android-styles-and-themes-tutorial - 如何風格的意見。是的,有很多工作 - 從6到81 .png進行編輯。不要忘記所有。相同的DPI的文件夾的PNG-S必須具有相同的寬度,高度和9的貼劑邊緣線 - 否則可以得到 「假象」 –

0

這是最後我得到了答案..但林不滿意這個答案...所以任何人有更好的解決方案?

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


     <!-- Bottom right side 1dp Shadow --> 
     <item> 
      <shape android:shape="rectangle" > 
       <solid android:color="@color/lighter_gray" /> 
      </shape> 
     </item> 

      <!-- Bottom 2dp Shadow --> 
     <item 
      android:bottom="1px" 
      android:right="1px"> 
      <shape android:shape="rectangle" > 
       <solid android:color="@color/light_gray" /> 
      </shape> 
     </item> 

     <!-- Bottom 2dp Shadow --> 
     <item 
      android:bottom="3px" 
      android:right="3px"> 
      <shape android:shape="rectangle" > 
       <solid android:color="@color/gray" /> 
      </shape> 
     </item> 

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

       <stroke 
        android:width="1dp" 
        android:color="@color/selector_color" /> 
      </shape> 
     </item> 

    </layer-list> 

的EditText

<EditText style="@style/match_width" 
android:background="@drawable/border_with_shadow" 
android:hint="Enter Order number" 
android:padding="5dp" 
android:paddingLeft="11dp" 
android:singleLine="true" 
android:textColor="#000000" 
android:textSize="16sp" /> 
+0

這是我的EDITTEXT: \t \t \t \t <的EditText \t \t \t \t \t風格= 「@風格/ MATCH_WIDTH」 \t \t \t \t \t機器人:背景= 「@繪製/ border_with_shadow」 \t \t \t \t \t機器人:提示= 「輸入訂單號」 \t \t \t \t \t機器人:填充= 「5DP」 \t \t \t \t \t機器人:paddingLeft = 「11DP」 \t \t \t \t \t機器人:SINGLELINE = 「真」 \t \t \t \t \t機器人:文字顏色=「# 000000「 \t \t \t \t \t android:textSize =」16sp「/> –

0

this is my output

這是我輸出的EditText這是不指望expected..I更準確