當前位置:首頁 » 安卓系統 » 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表示。

熱點內容
qq上傳視頻很慢怎麼辦 發布:2025-02-07 09:16:04 瀏覽:696
pythonredis緩存 發布:2025-02-07 09:10:24 瀏覽:927
封邊機主要看哪些配置 發布:2025-02-07 09:10:17 瀏覽:905
流控腳本破解 發布:2025-02-07 08:39:09 瀏覽:413
什麼是資源為什麼要研究資源配置 發布:2025-02-07 08:25:19 瀏覽:87
釣魚網站源碼製作 發布:2025-02-07 08:23:54 瀏覽:139
mac運行fl需要什麼配置 發布:2025-02-07 08:15:45 瀏覽:573
安卓怎麼做都比不了蘋果 發布:2025-02-07 08:12:47 瀏覽:238
怎麼給物理機配置ip地址 發布:2025-02-07 08:01:37 瀏覽:139
三國志13未加密 發布:2025-02-07 07:54:37 瀏覽:926