Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
2
Help us understand the problem. What is going on with this article?
@spless

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

More than 5 years have passed since last update.

とても簡単にイケてるシンプルなアイコンを使ってみました。
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
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
spless

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
2
Help us understand the problem. What is going on with this article?