Saturday, August 6, 2016

Membuat Material Design di Android

Bismillah .

Kali ini saya akan memposting mengenai material design.
Material design adalah sebuah desain yang memiliki patern, color dan image resource yang telah disediakan oleh google sehingga kita bisa membuat aplikasi yang bagus dengan mengikuti standart google

Screenshoot aplikasi material design drawer
Tampilan Material Design







Yuk mulai membuat aplikasi material design .




Kemudian Buat beberapa Fragment
 Jangan Centang 2 kolom tersebut
kemudian tambahkan kode Activity_Main.xml

app_bar_main xml

contect_main.xml
fragment_kontak.xml fragment_main.xml fragment_pendaftaran.xml fragment_portofolio fragment_profile.xml fragment_tentang.xml fragment_header_main.xml Pada Java : MainActivity.java MainFragment.java
PendaftranFragment.java
package com.example.taufiqhidayah.materialdesignima;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;


/** * A simple {@link Fragment} subclass. */public class PendaftaranFragment extends Fragment {


    public PendaftaranFragment() {
        // Required empty public constructor    }


    WebView wb;
    ProgressBar pg;

    @Override    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle saved) {
        View v = inflater.inflate(R.layout.fragment_pendaftaran, null);

        wb = (WebView) v.findViewById(R.id.webView1);
        pg = (ProgressBar) v.findViewById(R.id.progressBar1);
        wb.getSettings().setJavaScriptEnabled(true);
        wb.setWebViewClient(new WebViewClient());
        wb.getSettings().setDomStorageEnabled(true);
        wb.getSettings().setLoadWithOverviewMode(true);
        wb.getSettings().setUseWideViewPort(true);
        wb.getSettings().setSupportMultipleWindows(true);
        wb.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        wb.setHorizontalScrollBarEnabled(false);
        wb.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        wb.getSettings().setAllowFileAccessFromFileURLs(true);
        wb.getSettings().setAllowUniversalAccessFromFileURLs(true);
        wb.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                pg.setVisibility(View.VISIBLE);
                pg.setProgress(progress);
                if (progress == 100) {
                    pg.setVisibility(View.GONE);
                }
            }
        });
        pg.setVisibility(View.VISIBLE);
        wb.loadUrl("http://www.imastudio.co.id/pendaftaran/");
        return v;
    }

    @Override    public void onPause() {
        wb.onPause();
        super.onPause();
    }
}
 Portofolio.java
package com.example.taufiqhidayah.materialdesignima;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;


/** * A simple {@link Fragment} subclass. */public class PortofolioFragment extends Fragment {

    WebView wb;
    ProgressBar pg;

    @Override    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle saved) {
        View v = inflater.inflate(R.layout.fragment_portofolio, null);

        wb = (WebView) v.findViewById(R.id.webView2);
        pg = (ProgressBar) v.findViewById(R.id.progressBar2);
        wb.getSettings().setJavaScriptEnabled(true);
        wb.setWebViewClient(new WebViewClient());
        wb.getSettings().setDomStorageEnabled(true);
        wb.getSettings().setLoadWithOverviewMode(true);
        wb.getSettings().setUseWideViewPort(true);
        wb.getSettings().setSupportMultipleWindows(true);
        wb.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        wb.setHorizontalScrollBarEnabled(false);
        wb.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        wb.getSettings().setAllowFileAccessFromFileURLs(true);
        wb.getSettings().setAllowUniversalAccessFromFileURLs(true);
        wb.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                pg.setVisibility(View.VISIBLE);
                pg.setProgress(progress);
                if (progress == 100) {
                    pg.setVisibility(View.GONE);
                }
            }
        });
        pg.setVisibility(View.VISIBLE);
        wb.loadUrl("http://www.imastudio.co.id/portfolio/");
        return v;
    }

    @Override    public void onPause() {
        wb.onPause();
        super.onPause();
    }
}
 
Di Manifest tambahkan 
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> 
 Di Buil.grandel app tambahkan

compile 'de.hdodenhof:circleimageview:1.3.0'
 

0 komentar:

Post a Comment

Berkomentarlah dengan baik dan bijak..