Ich versuche, font-awesome Symbole verwenden und ein Problem haben. Es funktionierte von MainActivity, aber wenn ich Fragment benutze, werden die Icons nicht angezeigt.(Android) font-awesome Symbole nicht angezeigt
Das ist mein HomeFragment
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View home = inflater.inflate(R.layout.fragment_home, container, false);
View feed_row = inflater.inflate(R.layout.feed_row, container, false);
like_button = (Button) feed_row.findViewById(R.id.like_button);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/fontawesome-webfont.ttf");
like_button.setTypeface(tf);
mHomeFeed = (RecyclerView) home.findViewById(R.id.home_feed);
mLayoutManager = new LinearLayoutManager(this.getActivity());
mHomeFeed.setHasFixedSize(true);
mHomeFeed.setLayoutManager(mLayoutManager);
Dies ist feed_row.xml:
<Button
android:id="@+id/like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/icon_heart"
android:background="@color/noBackground"/>
strings.xml
<string name="icon_heart"></string>
<string name="icon_comment"></string>
Was soll ich jetzt tun? Es hatte keinen Fehler, aber Symbole sahen aus wie folgt: