<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginRight="2dp"
android:textColor="#FFFFFF" />try {
int version = getPackageManager().getPackageInfo("com.example.main", 0).versionCode;
((TextView)findViewById(R.id.version)).setText(version+".0.0");
} catch (NameNotFoundException e) {
e.printStackTrace();
}
本文介绍了一种在Android应用中获取自身应用版本号的方法,并展示了如何将版本号动态显示在应用界面上。
1万+

被折叠的 条评论
为什么被折叠?



