我想用字體很棒的圖標,並有一些問題。它從MainActivity起作用,但是當我從Fragment使用它時沒有顯示圖標。(Android)字體很棒的圖標不顯示
這是我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);
這是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>
我現在應該怎麼辦?它沒有錯誤,但圖標看上去象下面這樣: