تطبيق للموقع ديالك بإستعمال أندرويد الجزء الأول
فهاد المشروع من تطبيق للموقع ديالك بإستعمال أندرويد غادي نصاوبو واحد التطبيق بسيط للموقع ديالك بإستعمال ل webview يمكنلك من بعد تغير الروابط وتدير بلاصتهم روابط الموقع ديالك.
نظرة سريعة بالفيديو
1- ملفات الواجهة
أول حاجة غادي نديروها غادي نفتحو Android Studio وغادي نزيدو مشروع جديد سميتو WebsiteView منبعد غادي نمشي للمجلد res/layout وفالملف activity_main.xml غادي نزيد الكود لي فيه DrawerLayout لي كيمكني باش يكون عندي NavigationView لي غادي تمكني باش تكون عندي القائمة الجانبية لي كنشوفو فالفيديو الكود ديال الملف هو :
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.example.darijacoding.websiteview.MainActivity">
<include
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/header"
app:menu="@menu/drawer_menu" />
</android.support.v4.widget.DrawerLayout>
2- الملف header.xml
دائما فلمجلد res/layout كنزيد ملف سميه header.xml لي غادي يكون فالقائمة الجانبية ولي فيه صورة والإمايل الكود ديال الملف هو :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@color/colorPrimary"
android:gravity="bottom"
android:layout_width="match_parent"
android:layout_height="180dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="60dp"
android:layout_height="60dp"
android:tint="@color/white"
android:layout_centerInParent="true"
android:src="@drawable/logo" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_below="@+id/imageView"
android:layout_marginTop="10dp"
android:textColor="@color/white"
android:paddingLeft="10dp"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:text="DarijaCoding2017"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView
android:id="@+id/textView"
android:paddingLeft="10dp"
android:textColor="@color/white"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_below="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="contact@darija-coding.com" />
</RelativeLayout>
3- الملف toolbar.xml
دائما فلمجلد res/layout كنزيد ملف جديد سميه toolbar.xml لي غادي يكون فيه الكود لي كيمكن باش يكون عندنا لbar لي كيكون فيها عنوان التطبيق الكود ديال الملف هو :
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
4- الملف content_main.xml
دائما فلمجلد res/layout كنزيد ملف جديد سميه content_main.xml لي غادي يكون فيه ل FrameLayout الرئيسي لي غادي يتغير المحتوى ديالو بتغير الصفحات ديالنا الكود ديال الملف هو :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
5- الملف drawer_menu.xml
دائما فلمجلد res/menu كنزيد ملف جديد سميه drawer_menu.xml لي غادي يكون فيه لمكونات ديال القائمة الجانبية ديالنا الكود ديال الملف هو :
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:icon="@drawable/ic_home"
android:id="@+id/accueil"
android:title="Accueil" />
<item
android:icon="@drawable/ic_inscription"
android:id="@+id/insc"
android:title="Inscription" />
<item
android:icon="@drawable/ic_connexion"
android:id="@+id/con"
android:title="Connexion" />
<item
android:icon="@drawable/ic_contact"
android:id="@+id/contact"
android:title="Contact" />
</group>
</menu>