Metin rengini değiştirilebilen yerine seçici olarak değiştirdim. İyi çalışıyor. TextView'un
public class MyTextView extends TextView {
public MyTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public MyTextView(Context context) {
super(context);
init(context);
}
private void init(Context context) {
Typeface tf = Typeface.createFromAsset(context.getAssets(),
"fontawesome-webfont.ttf");
setTypeface(tf);
}
}
uzanır MyTextView sınıf oluşturun
text_color_selector.xml seçici
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#ff0000" android:state_pressed="true" />
<!-- pressed -->
<item android:color="#ff0000" android:state_focused="true" />
<!-- focused -->
<item android:color="#000000" />
<!-- default -->
</selector>
oluşturma Ve sonra
<com.example.mohsin.myapplication.MyTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="50sp"
android:clickable="true"
android:textColor="@drawable/text_color_selector"
android:text="\uF242">
</com.example.mohsin.myapplication.MyTextView>
Cevabınız için teşekkürler, ancak yazı tipi (metin) olduğu için, basit simge yerine, –
basit simge yerine kullanmak istiyorum. – droidev