7

TextView次のようなAndroidのテキストに内側の影を付けることができますか:

http://i.stack.imgur.com/88Mxd.png

ありがとう !

4

3 に答える 3

7

MagicTextViewは内側の影を行います。

ここに画像の説明を入力

    <com.qwerjk.better_text.MagicTextView
        xmlns:qwerjk="http://schemas.android.com/apk/res/com.qwerjk.better_text"
        android:textSize="42dp"
        android:textColor="#FFffff00"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textStyle="bold"
        android:padding="10dp"
        qwerjk:innerShadowDy="3"
        qwerjk:innerShadowColor="#FF000000"
        qwerjk:innerShadowRadius="5"
        android:text="InnerShadow" />

注: 私はこれを作成し、OP よりも将来の旅行者のために投稿しています。これは境界線上のスパムですが、話題に沿っているので、おそらく許容できますか?

于 2012-04-24T08:02:26.063 に答える
2

シャドウイング効果の場合:

 <TextView
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="5sp"
    android:paddingTop="15sp"
    android:paddingBottom="15sp"
    android:typeface="normal"
    android:text="I'm normal (bold) font but I have a shadow"
    android:textSize="16sp"
    android:textStyle="bold"
    android:shadowColor ="#0f0f0f"
    android:shadowRadius="1.6"
    android:shadowDx="1.5"
    android:shadowDy="1.3"
    android:textColor="#000000"
    android:background="#ffffff"
    />

または、独自のフォントを使用して、それらを res/assets フォルダーに配置できます。

TextView txt = (TextView) findViewById(R.id.custom_font);   
Typeface font = Typeface.createFromAsset(getAssets(), "my_font.ttf");  
txt.setTypeface(font);

または、詳細については次のリンクを確認してください。

http://www.barebonescoder.com/2010/05/android-development-using-custom-fonts/

http://www.giantflyingsaucer.com/blog/?p=1421

于 2011-11-01T11:38:08.663 に答える
1

これは、私が数か月前に尋ねた質問の複製です: Is there a way to add inner shadow to a TextView on Android?

現時点では、それを行う適切な方法はありません。しかし、テキストの色のアルファとドロップ シャドウをいじってみると、インナー シャドウに近いものになる可能性があります。

于 2011-11-01T11:40:05.207 に答える