Android project - Flash screen interface and GridView

Flash screen interface

General flash screen is the first interface of application . The main work applied in the flash screen interface generally includes :

* Exhibition logo( application logo, company logo)
* Project initialization
* Detect version updates
* Validity of verification procedure ( For example, whether there is a network )
The content displayed on the flash screen is usually a background picture . We can use the picture as the background of the layout
Generally, the flash screen should be displayed for at least a period of time

* Point1 ( Remove title )
General application , There is no title , Some words are too ugly . How to remove the title ?
Method is mainly to change the theme ,android Topic with or without title in , So how to set :
1. You can refer to this topic directly <application android:theme=
"@android:style/Theme.Light.NoTitleBar.Fullscreen"> 2. We can give @style/AppTheme
Add hidden Title Style <style name="AppTheme" parent="AppBaseTheme"> <!-- Hide title block --> <item
name="android:windowNoTitle">true</item> </style>
* Point2( Shadow text )
Shadow text to make it look more solid , Set shadow mainly depends on the following 4 Attributes :
<TextView android:shadowColor="#f00" android:shadowDx="1" android:shadowDy="1"
android:shadowRadius="1" android:text=" I have a shadow " />
You can see the setting shadow , In fact, the text is offset .

* Point3( Get version information dynamically )
Major dependence PackageManager:
PackageManager packageManager = getPackageManager(); PackageInfo packageInfo
= packageManager.getPackageInfo(getPackageName(), 0); mVersionCode = packageInfo
.versionCode; mVersionName = packageInfo.versionName;
* Point4 ( Version update )
The general steps are :
1. Get version information of the server ( Generally JSON Format interaction )
2. Prompt the user whether to download the new version according to the version information , And update .

Relevant knowledge and points to be noted are :
- Get network permissions android.permission.INTERNET - HttpURLConnection, URL -
Accessing the machine under the simulator Tomcat, Address available 10.0.2.2 perhaps The reality of your network IP - Android Next analysis JSON Object of : JSONObject -
dialog box AlertDialog.Builder AlertDialog - Activity When jumping , Think about Activity Do you want to finish()
* Point5 ( download APK file )
on top , If the user chooses to update , Then you need to download the new version of APK.
Relevant knowledge and points to be noted are :
- Download of files , Using a third-party framework XUtils - When downloading files locally , Should be judged first SD Whether the card is attached . And has access been obtained SD Card authority
.WRITE_EXTERNAL_STORAGE - Download progress bar settings , Should be downloaded , Related properties : visibility: gone or invisible
- After downloading , If under the simulator , Conflicts that should be placed on signed files Signature conflict is : Two applications , Package name conflict , But the signature file is different ; Official signature : Long term ( For decades ),
Password required , When publishing apps , It should be used for packaging Test signature : Short term of validity (1 year ),eclipse The default signature is debug.keystore, Alias is :android
Password is :androiddebugkey - Now when it's done , Installation interface shall be started : Intent intent = new Intent(Intent.ACTION
_VIEW); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setDataAndType(Uri
.fromFile(fileInfo.result), "application/vnd.android.package-archive");
startActivityForResult(intent,0); - Start like this , Because , If the user does not want to install ,
We can call back the function onActivityResult() in , Keep going
* Point6 (TextView Force focus )
If we want to make TextView What to show , It's OK to move like a lantern , But only if TextView Get the focus
You can set it like this :
<TextView android:ellipsize="marquee" android:focusable="true"
android:focusableInTouchMode="true" android:singleLine="true" android:text=
" I'll cycle through the display , Ha ha ha ha ha ha ha !!!" />
* Point7 ( Detail handling )

* Set the dialog box to cancel listening ,builder.setOnCancelListener()
* eclipse Next application packaging
AndroidTools->export signed application package ->
* about UI Refresh of , We can Handler in , Unified processing .
* We can add gradient animation to the flash screen
// Gradient animation of flash screen page AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1f);
alphaAnimation.setDuration(2000); rl.startAnimation(alphaAnimation);
//rl Is the linear layout of the flash page
GridView

For bar display , We can use ListView, And for the pattern similar to the nine palace grid , We can use
GridView, about GridView The use of ListView As like as two peas

Use steps :

* In layout file , add to GridView assembly
for example , Put this GridView Set to each line 3 column , Full screen
<GridView android:id="@+id/gv_home" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_weight="1" android:numColumns="3"
android:verticalSpacing="20dp" > </GridView>
* Design fill GridView Style of element
* Fill the layout file with GridView setContentView(R.layout.activity_home); gvHome =
(GridView) findViewById(R.id.gv_home); gvHome.setAdapter(new HomeAdapter());
class HomeAdapter extends BaseAdapter{ @Override public int getCount() { return
mItems.length; } @Overridepublic Object getItem(int position) { return
mItems[position]; } @Overridepublic long getItemId(int position) { return
position; } @Overridepublic View getView(int position, View convertView,
ViewGroup parent) { View gvItem = View.inflate(HomeActivity.this,
R.layout.grid_item,null); TextView tv = (TextView)
gvItem.findViewById(R.id.tv_item); ImageView iv = (ImageView)
gvItem.findViewById(R.id.iv_item); tv.setText(mItems[position]);
iv.setImageResource(mPics[position]);return gvItem; } }

Technology
©2019-2020 Toolsou All rights reserved,
element-ui Of el-date-picker Component get value ( Essence )2020 year 7 month 15 day Wechat applet import and include difference common 5 species JAVA Runtime exception The shortest path of maze BFS algorithm (python realization )python Short circuit logic in SpringBoot JpaRepository Database addition, deletion, modification and query ( Essence )2020 year 7 month 15 day Wechat applet template Use of Hackbar Using the tutorial org.postgresql.util.PSQLException Processing records ( Essence )2020 year 6 month 26 day C# Class library Loop execution help class