當前位置:首頁 » 安卓系統 » android身份證

android身份證

發布時間: 2025-02-07 06:36:43

㈠ android 身份證號的4到11位用*顯示怎麼做

參考以下代碼:

java">packagecom.sh.xy;

importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.view.Menu;
importandroid.view.MenuItem;
importandroid.view.View;
importandroid.view.View.OnClickListener;
importandroid.view.Window;
importandroid.widget.Button;
importandroid.widget.EditText;
importandroid.widget.Toast;

{

//完整身份證
Stringid="323218200001010010";

privateEditTexted_id;
privateButtonbtn_show;
privateButtonbtn_show_to_edit;

@Override
protectedvoidonCreate(BundlesavedInstanceState){
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);

//用於顯示的加*身份證
Stringshow_id=id.substring(0,3)+"********"+id.substring(11);

ed_id.setText(show_id);

btn_show.setOnClickListener(newOnClickListener(){
@Override
publicvoidonClick(Viewv){
Toast.makeText(MainActivity.this,id,Toast.LENGTH_SHORT).show();
}
});

btn_show_to_edit.setOnClickListener(newOnClickListener(){
@Override
publicvoidonClick(Viewv){
ed_id.setText(id);
}
});
}

@Override
(Menumenu){
getMenuInflater().inflate(R.menu.main,menu);
returntrue;
}

@Override
(MenuItemitem){
intid=item.getItemId();
if(id==R.id.action_settings){
returntrue;
}
returnsuper.onOptionsItemSelected(item);
}
}

布局文件:

<LinearLayoutxmlns: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: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>

運行效果:

㈡ android studio 如何輸入身份證號自動顯示籍貫和生日

EXCEL中輸入身份證號碼就能自動顯示籍貫的公式編寫方法:
找一個省份代碼表復制到sheet2中(a列代碼,b列省份),然後在b1中使用公式
=vlookup(left(a1,2),sheet2!a:b,2,0)。
身份證號碼中:
(1)前1、2位數字表示:所在省份的代碼;?
(2)第3、4位數字表示:所在城市的代碼;?
(3)第5、6位數字表示:所在區縣的代碼;?
(4)第7~14位數字表示:出生年、月、日;?
(5)第15、16位數字表示:所在地的派出所的代碼;?
(6)第17位數字表示性別:奇數表示男性,偶數表示女性;?
(7)第18位數字是校檢碼:用來檢驗身份證的正確性。校檢碼可以是0~10的數字,10用x表示。

熱點內容
魅族手機怎麼找回密碼 發布:2025-03-14 02:35:48 瀏覽:296
配置高低主要看什麼 發布:2025-03-14 01:49:22 瀏覽:85
locpython 發布:2025-03-14 01:12:50 瀏覽:342
java數組的定義方法 發布:2025-03-14 00:53:25 瀏覽:517
壓縮性綳帶 發布:2025-03-14 00:30:21 瀏覽:184
如何給樹莓派編譯適合的軟體 發布:2025-03-14 00:29:45 瀏覽:376
c語言編譯器雲盤鏈接 發布:2025-03-14 00:25:23 瀏覽:349
電腦上哪個游戲可以移植到安卓上 發布:2025-03-14 00:10:32 瀏覽:473
tcl編譯器 發布:2025-03-13 23:52:59 瀏覽:323
linuxnamed 發布:2025-03-13 23:45:29 瀏覽:363