Post date: Jan 17, 2019 11:02:58 AM
ໂຄດສ້າງແອບ
ໂຄດສ້າງແອບແບບງ່າຍສຳລັບການຈົດ-ຈື່ແບບການຫຍໍ້ແບບສັ້ນໆ ສຳລັບນັກຮຽນຮູ້ຕ່າງໆ ທີ່ຢາກຮຽນສ້າງແອບໄວ່ໃຊ້ເປັນສ່ວນຕົວເພື່ອຕິດຕັ້ງໄວ່ໃນໂທລະສັບຂອງທ່ານ. ໂຄດທາງດ້ານລູ່ມນີ້ເປັນໂຄດທີ່ຂ້ອຍລວບລວມເອົາແດ່ຈຸດສຳຄັນເທົ່ານັ້ນ.
ໂຄດນີ້ແມ່ນຕິດຕໍ່ອິນເຕີເນັດເຂົ້າແອບ
Connect internet :
<uses-permission android:name="android.permission.INTERNET"/>
ໂຄດນີ້ແມ່ນການອອກແບບ ຫຼືສ້າງໂຄ້ງຮ່າງແອບ
Page home webview :
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
//ສ້າງໄອດີເພື່ອຕິດຕໍ່ແອບ
android:id="@+id/hd">
</WebView>
ໂຄດນີ້ແມ່ນການສ້າງໂຄດເພື່ອຕິດຕໍ່ໜ້າອອກແບບແອບ
public class Page extends AppCompatActivity {
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_page);
webView = (WebView) findViewById(R.id.hd);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
//ທີ່ຢູ່ຂອງເວບຕິດຕໍ່
webView.loadUrl("http://daotao.hdu.edu.vn");
//ການຊູມເຂົ້າຊູມອອກຂອງແອບ
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(false);
}
}
ໂຄດນີ້ຈະເຮັດໃຫ້ໜ້າແອບການໃຊ້ງ່ານແບບເຕັມຈໍໂທລະສັບ
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowFullscreen">true</item>
</style>
</resources>
ໂຄດນີ້ແມ່ນຕັ້ງເວລາເຂົ້າສູ້ແອບເມື່ອທ່ານເປີດໃຊ້ງ່ານທຸກໆ ຄັ້ງ
Time anim In App
<?xml version="1.0" encoding="utf-8"?>
<alpha
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="0.0"
android:toAlpha="0.1"
android:duration="1000"/>
Wellcome In App
imageView = (ImageView) findViewById(R.id.im);
Animation animation = AnimationUtils.loadAnimation(this,R.anim.transitions);
imageView.startAnimation(animation);
final Intent i = new Intent(this,wv.class);
Thread timer = new Thread(){
public void run(){
try{
sleep(5000);
}catch (InterruptedException e){
e.printStackTrace();
}
finally {
startActivity(i);
finish();
}
}
};
timer.start();
}
ໂຄດນີ້ແມ່ນໂຄດກັບຄືນ
@Override
public void onBackPressed(){
if(webView.canGoBack()){
webView.goBack();
}else {
super.onBackPressed();
}
}
ໂຄດນີ້ແມ່ນໂຄດຢືນຢັນການກົດອອກຈາກແອບ
@Override
public void onBackPressed(){
final AlertDialog.Builder builder = new AlertDialog.Builder(Page.this);
builder.setMessage("ທ່ານຈະອອກຈາກແອບນີ້ແທ້ ຫຼື ບໍ່?");
builder.setCancelable(true);
builder.setNegativeButton("ຕົກລົງ! ອອກ.", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
finish();
}
});
builder.setPositiveButton("ບໍ່ອອກ !", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int i) {
dialog.cancel();
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
ບົດຄວາມຈາກ : ນະ ພມສ ຜູ້ມັກແບ່ງບັນຄວາມຮູ້
ອ່ານແລ້ວກົດໄລຄໃຫ້ແດ່ເພື່ອເປັນກຳລັງໃຈໃນການພັດທະນາຕໍ່ໄປ....
ວັນທີ່ 17 / 01 / 2019 06:20 PM