Emojify 人脸识别表情
Posted neowu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Emojify 人脸识别表情相关的知识,希望对你有一定的参考价值。
效果图:
人脸识别成表情需要playservice服务支持
grandle:
dependencies {
implementation fileTree(include: [‘*.jar‘], dir: ‘libs‘)
implementation ‘com.android.support:appcompat-v7:28.0.0‘
implementation ‘com.android.support:support-v4:28.0.0‘
implementation ‘com.android.support.constraint:constraint-layout:1.1.3‘
testImplementation ‘junit:junit:4.12‘
androidTestImplementation ‘com.android.support.test:runner:1.0.2‘
androidTestImplementation ‘com.android.support.test.espresso:espresso-core:3.0.2‘
implementation ‘com.android.support:design:28.0.0‘
implementation ‘com.google.android.gms:play-services-vision:10.2.0‘
implementation ‘com.jakewharton:butterknife:8.8.1‘
annotationProcessor ‘com.jakewharton:butterknife-compiler:8.8.1‘
implementation ‘com.jakewharton.timber:timber:4.7.0‘
}
activity.main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
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="com.example.admin.emojify.MainActivity">
<ImageView
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/view_margin"
android:contentDescription="@string/imageview_description"
android:scaleType="fitStart" />
<TextView
android:id="@+id/title_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/emojify_button"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/view_margin"
android:text="@string/emojify_me"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
<Button
android:id="@+id/emojify_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/go"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/clear_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:visibility="gone"
android:src="@drawable/ic_clear"
app:backgroundTint="@android:color/white"
app:fabSize="mini" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/save_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/fab_margins"
android:layout_marginEnd="@dimen/fab_margins"
android:layout_marginRight="@dimen/fab_margins"
android:src="@drawable/ic_save"
android:visibility="gone"
app:backgroundTint="@android:color/white" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/share_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"