TextView
次のようなAndroidのテキストに内側の影を付けることができますか:
ありがとう !
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 よりも将来の旅行者のために投稿しています。これは境界線上のスパムですが、話題に沿っているので、おそらく許容できますか?
シャドウイング効果の場合:
<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/
と
これは、私が数か月前に尋ねた質問の複製です: Is there a way to add inner shadow to a TextView on Android?
現時点では、それを行う適切な方法はありません。しかし、テキストの色のアルファとドロップ シャドウをいじってみると、インナー シャドウに近いものになる可能性があります。