2015-04-23 57 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更准确