Java 如何设置TextView边框的阴影

Java 如何设置TextView边框的阴影,java,android,textview,Java,Android,Textview,我想为TextView边框设置一个shadow TextView t = new TextView(getBaseContext()); 如果我实现下面的代码,它会在TextView t.setShadowLayer(1.5f, -1, 1, Color.BLACK); 但是有没有办法设置TextView边框的阴影?试试: t.setShadowLayer(1, 0, 0, Color.BLACK); 或者在您的布局XML中: <TextView android:layout_

我想为
TextView
边框设置一个
shadow

TextView t = new TextView(getBaseContext());
如果我实现下面的代码,它会在
TextView

t.setShadowLayer(1.5f, -1, 1, Color.BLACK);
但是有没有办法设置TextView边框的阴影?

试试:

t.setShadowLayer(1, 0, 0, Color.BLACK);
或者在您的布局XML中:

<TextView
   android:layout_width="fill_parent" 
   android:shadowRadius="2"  
   android:shadowColor="#0000ff"
   android:shadowDx="2"
   android:shadowDy="4" 
   android:id="@+id/EditText01" 
   android:layout_height="wrap_content" />

试试:

或者在您的布局XML中:

<TextView
   android:layout_width="fill_parent" 
   android:shadowRadius="2"  
   android:shadowColor="#0000ff"
   android:shadowDx="2"
   android:shadowDy="4" 
   android:id="@+id/EditText01" 
   android:layout_height="wrap_content" />

试试:

或者在您的布局XML中:

<TextView
   android:layout_width="fill_parent" 
   android:shadowRadius="2"  
   android:shadowColor="#0000ff"
   android:shadowDx="2"
   android:shadowDy="4" 
   android:id="@+id/EditText01" 
   android:layout_height="wrap_content" />

试试:

或者在您的布局XML中:

<TextView
   android:layout_width="fill_parent" 
   android:shadowRadius="2"  
   android:shadowColor="#0000ff"
   android:shadowDx="2"
   android:shadowDy="4" 
   android:id="@+id/EditText01" 
   android:layout_height="wrap_content" />

最好的方法/有效的方法是通过9patch。。你可以按程序来做,但这会让你付出一些速度或滞后


有一个很好的例子。

最好的方法/有效的方法是通过9patch。。你可以按程序来做,但这会让你付出一些速度或滞后


有一个很好的例子。

最好的方法/有效的方法是通过9patch。。你可以按程序来做,但这会让你付出一些速度或滞后


有一个很好的例子。

最好的方法/有效的方法是通过9patch。。你可以按程序来做,但这会让你付出一些速度或滞后


有一个很好的例子。

要在边框上获得阴影效果,可以将TextView包装成一个。

要在边框上获得阴影效果,可以将TextView包装成一个。

要在边框上获得阴影效果,可以将TextView包装成一个。

要在边框上获得阴影效果,您可以将TextView包装成一个卷。

我发现向我的TextView添加阴影的最佳波浪是:

android:elevation="3dp"

仅适用于API 21或更高版本。

我发现向我的文本视图添加阴影的最佳方式是:

android:elevation="3dp"

仅适用于API 21或更高版本。

我发现向我的文本视图添加阴影的最佳方式是:

android:elevation="3dp"

仅适用于API 21或更高版本。

我发现向我的文本视图添加阴影的最佳方式是:

android:elevation="3dp"

仅适用于API 21或更高版本。

setShadowLayer
将阴影设置为
TextView
中的文本。问题明确地说,“它在TextView
t.setShadowLayer(1.5f,-1,1,Color.BLACK);
中为文本创建阴影,但是有没有办法为TextView的边框设置阴影?”
setShadowLayer
将阴影设置为
TextView
中的文本。问题明确地说,“它在TextView
t.setShadowLayer(1.5f,-1,1,Color.BLACK);
中为文本创建阴影,但是有没有办法为TextView的边框设置阴影?”
setShadowLayer
将阴影设置为
TextView
中的文本。问题明确地说,“它在TextView
t.setShadowLayer(1.5f,-1,1,Color.BLACK);
中为文本创建阴影,但是有没有办法为TextView的边框设置阴影?”
setShadowLayer
将阴影设置为
TextView
中的文本。问题明确地说,“它在TextView
t.setShadowLayer(1.5f,-1,1,Color.BLACK);
中为文本创建阴影,但是有没有办法为TextView的边框设置阴影?”