LoginSignup
2
2

More than 5 years have passed since last update.

[お洒落アイコン簡単設置]Font AwesomeをAndroidで使う方法[初心者用]

Posted at

とても簡単にイケてるシンプルなアイコンを使ってみました。
Web制作のときにお世話になりまくりのFont Awesomeです。

初心者趣味プログラマーなのでツッコミどころ満載だと思うので
容赦ないツッコミよろしくお願いします

わかりにくい。
ここは良くない等の指摘は大歓迎です。
ガンガンコメントください。

android-iconifyを使う

gradle

compile 'com.joanzapata.android:android-iconify:1.0.10'

↓最小限のサンプル↓

layoutのactivity_main.xmlで使ってみる

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity">

    <IconTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:shadowColor="#22000000"
        android:shadowDx="3"
        android:shadowDy="3"
        android:shadowRadius="1"
        android:text="{fa-android} Android"
        android:textSize="45dp"
        android:textColor="#FF33B5E5" />

</RelativeLayout>

ActionBarで使ってみる

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        MenuItem actionItem = menu.add("man");
        Drawable aboutDrawable = new IconDrawable(this, Iconify.IconValue.fa_male)
                .colorRes(R.color.blue)
                .actionBarSize();
        actionItem.setIcon(aboutDrawable);
        actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        return true;
    }

少しでもここは直すべきと思うことあれば...

もし時間あって気が向いた時にでも
コメントで指摘してもらえたら嬉しいです。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2