當前位置:首頁 » 安卓系統 » 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-07-10 20:47:32 瀏覽:411
lol伺服器滿載怎麼辦 發布:2025-07-10 20:31:08 瀏覽:328
sql2005腳本導出數據 發布:2025-07-10 20:31:05 瀏覽:112
三星手機伺服器停止運行怎麼辦 發布:2025-07-10 20:21:07 瀏覽:868
華為手機原廠設置密碼多少 發布:2025-07-10 20:19:54 瀏覽:242
如何重設伺服器地址 發布:2025-07-10 20:19:53 瀏覽:568
bp神經網路演算法c 發布:2025-07-10 20:00:00 瀏覽:700
sqlserver導出mdf 發布:2025-07-10 19:52:55 瀏覽:673
安卓應用怎麼樣安裝電腦 發布:2025-07-10 19:51:16 瀏覽:192
java修改文件時間 發布:2025-07-10 19:50:30 瀏覽:993