https://github.com/Giousa/Android-Iconics
1;
implementation "com.mikepenz:iconics-core:3.0.1@aar"
implementation 'com.mikepenz:ionicons-typeface:2.0.1.4@aar'
2,congtext,ignore 一定要写不然报错
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:background="#E7F1F3"
tools:context=".act.LoginActivity"
tools:ignore="MissingPrefix">
<ImageView
android:id="@+id/iv_img"
android:layout_width="60dp"
android:layout_height="60dp"
app:ico_color="#FF0000"
app:ico_icon="ion-home"
app:ico_size="60dp"
/>
</LinearLayout>
3,
public class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
LayoutInflaterCompat.setFactory2(getLayoutInflater(), new IconicsLayoutInflater2(getDelegate()));
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
}