
正文
android身份证,android身份证识别 开源
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
android 身份证号的4到11位用*显示怎么做?
参考以下代码:
package com.sh.xy;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity {
// 完整身份证
String id = "323218200001010010";
private EditText ed_id;
private Button btn_show;
private Button btn_show_to_edit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
ed_id = (EditText) findViewById(R.id.ed_id);
btn_show = (Button) findViewById(R.id.show_id);
btn_show_to_edit = (Button) findViewById(R.id.show_id_to_edit);
// 用于显示的加*身份证
String show_id = id.substring(0, 3) + "********" + id.substring(11);
ed_id.setText(show_id);
btn_show.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, id, Toast.LENGTH_SHORT).show();
}
});
btn_show_to_edit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ed_id.setText(id);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
布局文件:
LinearLayout xmlns:android=""
xmlns:tools=""
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.sh.xy.MainActivity"
include
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/layout_title_bar" /
EditText
android:id="@+id/ed_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="显示加*身份ID" /
Button
android:id="@+id/show_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="显示完整身份ID" /
Button
android:id="@+id/show_id_to_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="将完整身份ID至编辑框" /
/LinearLayout
运行效果:
点击【显示得完整身份ID】按钮:
点击【将完整身份ID至编辑框】按钮:
[img]相关问答
Q1: android怎么使用身份证阅读器模组
openGL提供了大量的图像识别库和api供你调用,用openGL做起来很简单的,说简单是因为身份证长的都一样,什么位置显示什么信息都是固定的几年十几年都不会变,这个给识别带来很大的便利。首先要把照片里的身份证区域识别出来
Q2: 小白求教 android 身份证识别 功能
您好,云脉身份证识别支持API和SDK接入了,可以到云脉开发者平台上下载使用。
Q3: android 身份证,银行卡识别 功能怎么做
要是自己动手写几乎不太可能,需要集成别人的api,不过应该是收费的







