AIDE - AlertDialog Customizado









ATENÇÃO - CONTEÚDO COMPATIVEL COM ANDROID KITKAT OU ACIMA



Arquivo - build.gradle - ..\app\build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "projeto.meu.com.meuprojeto"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
compile 'com.android.support:design:+'
compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

 
}



//////////////////////////////////////////////////////////////////////


Arquivo - AndroidManifest.xml - ..\app\src\main\AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="projeto.meu.com.meuprojeto">
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

</manifest>
//////////////////////////////////////////////////////////////////////


Arquivo - MainActivity.java ..\app\src\main\java\projeto\meu\com\meuprojeto\MainActivity.java

package projeto.meu.com.meuprojeto;

import android.Manifest;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.*;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.design.widget.*;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.*;
import android.view.*;
import android.widget.*;
import android.support.v7.widget.Toolbar;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;


public class MainActivity extends AppCompatActivity {
    public static String sred = "ToolBar ser tornou: Vermelha";
    public static String sgreen = "ToolBar ser tornou: Verde";
    public static String sblue = "ToolBar ser tornou: Azul";
    public static String sblack = "ToolBar ser tornou: Preta";
    public static MediaPlayer a, b = new MediaPlayer();
    private static final int PERMISSIONS = 102;
    public static Button check,run,black,blue,green,red,padrao;
    public static Toolbar toolbar;
    public static FloatingActionButton fab;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        a = MediaPlayer.create(this, R.raw.a);
        b = MediaPlayer.create(this, R.raw.b);
        check = (Button) findViewById(R.id.check);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
       setSupportActionBar(toolbar);

        memoria();
        /*
        SharedPreferences Botao = getSharedPreferences("Dados", MODE_PRIVATE);
        String botao = Botao.getString("botao", "");
        switch (botao) {
            case "vermelho":
                toolbar.setBackgroundResource(R.drawable.botaored);
                break;
            case "verde":
                toolbar.setBackgroundResource(R.drawable.botao2);
                break;
            case "azul":
                toolbar.setBackgroundResource(R.drawable.btn);
                break;
            case "preto":
                toolbar.setBackgroundResource(R.drawable.botaopreto);
                break;
            default:
                //noinspection deprecation
                toolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
                break;
        }
         */

        //if (Build.VERSION.SDK_INT < 23) {}


        fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                a.start();
                Intent share = new Intent(Intent.ACTION_SEND);
                share.setType("text/plain");
                //noinspection deprecation
                share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
                share.putExtra(Intent.EXTRA_TEXT, "Nome APP..." + "\n" +
                        "Descrição" + "\n" + "\n" +
                        "http://www.aksr.com.br/" + "\n");
                startActivity(Intent.createChooser(share, "Compartilhar"));


                //Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                //.setAction("Action", null).show();
            }
        });
        run = (Button) findViewById(R.id.run);
        run.setVisibility(View.GONE);
        run.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                a.start();
                checkAndRequestPermissions();
            }
        });

        //Build.VERSION_CODES.M
        if (Build.VERSION.SDK_INT < 23) {run.setVisibility(View.VISIBLE);}else {
            int MEM = ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
            if (MEM == PackageManager.PERMISSION_DENIED) {
                run.setVisibility(View.VISIBLE);
            }
        }


        padrao = (Button) findViewById(R.id.padrao);
        padrao.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                a.start();
                Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                //noinspection deprecation
                toolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary));

                //SharedPreferences preto = getSharedPreferences("Dados", MODE_PRIVATE);
                //SharedPreferences.Editor editor = preto.edit();
                // editor.putString("botao", "");
                //editor.apply();


                defeaut();
            }
        });


        black = (Button) findViewById(R.id.black);
        black.setBackgroundResource(R.drawable.botaopreto);
        black.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                a.start();
                Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                toolbar.setBackgroundResource(R.drawable.botaopreto);
                toolbar.setTitle(sblack);

                //SharedPreferences preto = getSharedPreferences("Dados", MODE_PRIVATE);
                //SharedPreferences.Editor editor = preto.edit();
                // editor.putString("botao", "preto");
                // editor.apply();


                black();
            }
        });

        blue = (Button) findViewById(R.id.blue);
        blue.setBackgroundResource(R.drawable.btn);
        blue.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                b.start();
                Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                toolbar.setBackgroundResource(R.drawable.btn);
                toolbar.setTitle(sblue);

                //SharedPreferences azul = getSharedPreferences("Dados", MODE_PRIVATE);
                //SharedPreferences.Editor editor = azul.edit();
                // editor.putString("botao", "azul");
                // editor.apply();


                blue();

            }
        });

        green = (Button) findViewById(R.id.green);
        green.setBackgroundResource(R.drawable.botao2);
        green.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                a.start();
                Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                toolbar.setBackgroundResource(R.drawable.botao2);
                toolbar.setTitle(sgreen);

                //SharedPreferences verde = getSharedPreferences("Dados", MODE_PRIVATE);
                //SharedPreferences.Editor editor = verde.edit();
                //editor.putString("botao", "verde");
                //editor.apply();


                green();

            }
        });


        red = (Button) findViewById(R.id.red);
        red.setBackgroundResource(R.drawable.botaored);
        red.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                b.start();
                toolbar.setBackgroundResource(R.drawable.botaored);
                toolbar.setTitle(sred);

                //SharedPreferences vermelho = getSharedPreferences("Dados", MODE_PRIVATE);
                //SharedPreferences.Editor editor = vermelho.edit();
                //editor.putString("botao", "vermelho");
                //editor.apply();


                red();
            }
        });


    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        SubMenu subMenu = menu.addSubMenu(Menu.NONE, 0, 0, "");
        subMenu.getItem().setIcon(R.drawable.m);
        subMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        subMenu.add(0, 1, 0, R.string.action_settings).setIcon(R.drawable.eng);
        // subMenu.add(0, 2, 0, R.string.app_name).setIcon(R.drawable.ic_launcher);


        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        b.start();
        switch (item.getItemId()) {
            case 1:
                Intent intent = new Intent();
                intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                Uri uri = Uri.parse("package:" + getPackageName());
                intent.setData(uri);
                startActivity(intent);
                return true;

        }

        return super.onOptionsItemSelected(item);
    }

 
@Override
    public void onBackPressed() {
        customDialog = new Dialog(MainActivity.this, R.style.Theme_Dialog_Translucent);
        customDialog.getWindow().getAttributes().windowAnimations = R.style.Dialogenter;
        customDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        customDialog.setContentView(R.layout.choices);
        customDialog.setCancelable(true);




        c1 = (TextView) customDialog.findViewById(R.id.c1);
        c1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "Opção 1  ", Toast.LENGTH_LONG).show();

            }
        });

        c2 = (TextView) customDialog.findViewById(R.id.c2);
        c2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "Opção 2  ", Toast.LENGTH_LONG).show();
            }
        });

        c3 = (TextView) customDialog.findViewById(R.id.c3);
        c3.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "Opção 3  ", Toast.LENGTH_LONG).show();
            }
        });
        c4 = (TextView) customDialog.findViewById(R.id.c4);
        c4.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this);
                dialog.setTitle("Sair");
                dialog.setMessage("Deseja sair?");
                dialog.setCancelable(true);
                dialog.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        finish();
                        System.exit(0);
                    }
                });
                dialog.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });
                dialog.setIcon(android.R.drawable.ic_dialog_alert)
                        .show();

            }
        });
        c5 = (TextView) customDialog.findViewById(R.id.c5);
        c5.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                finish();
                System.exit(0);
            }
        });
        c6 = (TextView) customDialog.findViewById(R.id.c6);
        c6.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                customDialog.dismiss();
            }
        });

        customDialog.show();
    }

    void red() {
        File folder = new File(Environment.getExternalStorageDirectory() + "/PROJETO");
        File fileWithinMyDir = new File(folder, "Dados.txt");
        try {
            FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file.

            String content = "vermelho";

            byte[] contentInBytes = content.getBytes();

            out.write(contentInBytes);
            out.flush();
            out.close();

        } catch (IOException e) {
            e.printStackTrace();
        }

        if (!folder.exists()) {
            //noinspection ResultOfMethodCallIgnored
            folder.mkdir();

        }

    }

    void green() {
        File folder = new File(Environment.getExternalStorageDirectory() + "/PROJETO");
        File fileWithinMyDir = new File(folder, "Dados.txt");
        try {
            FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file.

            String content = "verde";

            byte[] contentInBytes = content.getBytes();

            out.write(contentInBytes);
            out.flush();
            out.close();

        } catch (IOException e) {
            e.printStackTrace();
        }

        if (!folder.exists()) {
            //noinspection ResultOfMethodCallIgnored
            folder.mkdir();

        }

    }

    void black() {
        File folder = new File(Environment.getExternalStorageDirectory() + "/PROJETO");
        File fileWithinMyDir = new File(folder, "Dados.txt");
        try {
            FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file.

            String content = "preto";

            byte[] contentInBytes = content.getBytes();

            out.write(contentInBytes);
            out.flush();
            out.close();

        } catch (IOException e) {
            e.printStackTrace();
        }

        if (!folder.exists()) {
            //noinspection ResultOfMethodCallIgnored
            folder.mkdir();
        }

    }


    void blue() {
        File folder = new File(Environment.getExternalStorageDirectory() + "/PROJETO");
        File fileWithinMyDir = new File(folder, "Dados.txt");
        try {
            FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file.

            String content = "azul";

            byte[] contentInBytes = content.getBytes();

            out.write(contentInBytes);
            out.flush();
            out.close();

        } catch (IOException e) {
            e.printStackTrace();
        }

        if (!folder.exists()) {
            //noinspection ResultOfMethodCallIgnored
            folder.mkdir();

        }


    }


    void defeaut() {
        File folder = new File(Environment.getExternalStorageDirectory() + "/PROJETO");
        File fileWithinMyDir = new File(folder, "Dados.txt");
        try {
            FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file.

            String content = "";

            byte[] contentInBytes = content.getBytes();

            out.write(contentInBytes);
            out.flush();
            out.close();

        } catch (IOException e) {
            e.printStackTrace();
        }

        if (!folder.exists()) {
            //noinspection ResultOfMethodCallIgnored
            folder.mkdir();
            //noinspection ResultOfMethodCallIgnored
        }

    }


    @TargetApi(Build.VERSION_CODES.M)
    private boolean checkAndRequestPermissions() {
        int LER = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
        int ESCREVER = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);

        List<String> listPermissionsNeeded = new ArrayList<>();

        if (LER != PackageManager.PERMISSION_GRANTED) {
            listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);
        }
        if (ESCREVER != PackageManager.PERMISSION_GRANTED) {
            listPermissionsNeeded.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
        }
        if (!listPermissionsNeeded.isEmpty()) {
            requestPermissions(listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]),
                    PERMISSIONS);
            return false;
        }
        return true;
    }


    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCode == PERMISSIONS) {
            if (grantResults.length > 0) {
                for (int i = 0; i < permissions.length; i++) {

                    if (permissions[i].equals(Manifest.permission.READ_EXTERNAL_STORAGE)) {
                        if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
                            Toast.makeText(MainActivity.this, "Acesso: concedido" + "[ Agora você pode LER seus arquivos ]", Toast.LENGTH_SHORT).show();
                            finish();
                        }

                    } else if (permissions[i].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                        if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
                            Toast.makeText(MainActivity.this, "Acesso: concedido" + "[ Agora você pode ESCREVER em seus arquivos ]", Toast.LENGTH_SHORT).show();
                            finish();
                        }
                    }
                }

            }
        }
    }





    void memoria(){
        try {
              check = (Button) findViewById(R.id.check);
              toolbar = (Toolbar) findViewById(R.id.toolbar);

            File folder = new File(Environment.getExternalStorageDirectory() + "/PROJETO");
            File fileWithinMyDir = new File(folder, "Dados.txt");

            FileInputStream fIn = new FileInputStream(fileWithinMyDir);
            BufferedReader myReader = new BufferedReader(
                    new InputStreamReader(fIn));
            String aDataRow = "";
            String aBuffer = "";
            while ((aDataRow = myReader.readLine()) != null) {
                aBuffer += aDataRow;
            }

            check.setText(aBuffer);
            myReader.close();
            Toast.makeText(getBaseContext(), aBuffer,
                    Toast.LENGTH_LONG).show();
            switch (aBuffer) {
                case "vermelho":
                    toolbar.setBackgroundResource(R.drawable.botaored);
                    break;
                case "verde":
                    toolbar.setBackgroundResource(R.drawable.botao2);
                    break;
                case "azul":
                    toolbar.setBackgroundResource(R.drawable.btn);
                    break;
                case "preto":
                    toolbar.setBackgroundResource(R.drawable.botaopreto);
                    break;
                case "fechar":
                    Toast.makeText(MainActivity.this, "Aplicação em Manutenção", Toast.LENGTH_SHORT).show();
                    break;
                default:
                    //noinspection deprecation
                    toolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
                    break;
            }


        } catch (Exception e) {
            check = (Button) findViewById(R.id.check);
            check.setText("Permissão Negada");
        }
    }


}






//////////////////////////////////////////////////////////////////////


Imagens ..\app\src\main\res\drawable\



















//////////////////////////////////////////////////////////////////////



Sons colocados na Pasta - raw





Arquivo- activity_main.xml ..\app\src\main\res\layout\activity_main.xml


<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="projeto.meu.com.meuprojeto.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_main" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_menu_share" />

</android.support.design.widget.CoordinatorLayout>



//////////////////////////////////////////////////////////////////////


Arquivo- content_main.xml ..\app\src\main\res\layout\content_main.xml


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="projeto.meu.com.meuprojeto.MainActivity"
tools:showIn="@layout/activity_main">

<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent">

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="0dp">

<RelativeLayout
android:contentDescription="@string/app_name"
android:layout_width="fill_parent"
android:layout_height="500dp"
android:layout_marginTop="15dp"
android:id="@+id/relativeLayout7">

<Button
android:layout_width="120dp"
android:layout_height="50dp"
android:text="Preto"
android:id="@+id/black"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textAlignment="center"
/>

<Button
android:layout_height="50dp"
android:layout_width="120dp"
android:text="Vermelho"
android:id="@+id/red"
android:layout_below="@+id/green"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textAlignment="center" />

<Button
android:layout_height="50dp"
android:layout_width="120dp"
android:text="Verde"
android:id="@+id/green"
android:layout_below="@+id/blue"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textAlignment="center" />

<Button
android:layout_height="50dp"
android:layout_width="120dp"
android:text="Azul"
android:id="@+id/blue"
android:layout_below="@+id/black"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textAlignment="center" />

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/red"
android:layout_centerHorizontal="true"
android:layout_marginTop="82dp">

<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/face"
android:background="@drawable/face"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/tube"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/face"
android:layout_toEndOf="@+id/face"
android:background="@drawable/tube" />

<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/twitter"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/tube"
android:layout_toEndOf="@+id/tube"
android:background="@drawable/twitter" />

<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/site"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/twitter"
android:layout_toEndOf="@+id/twitter"
android:background="@drawable/blogspot" />

<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/linked"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/site"
android:layout_toEndOf="@+id/site"
android:background="@drawable/linked" />

<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/button"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/linked"
android:layout_toEndOf="@+id/linked"
android:background="@android:drawable/btn_star_big_on" />

<Button
            android:layout_width="250dp"
            android:layout_height="50dp"
            android:id="@+id/link"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:background="@drawable/def" />

</RelativeLayout>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Padrão"
android:id="@+id/padrao"
android:layout_above="@+id/green"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Run Time Permission"
android:id="@+id/run"
android:layout_above="@+id/red"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/check"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />

</RelativeLayout>

</RelativeLayout>
</ScrollView>

</RelativeLayout>



//////////////////////////////////////////////////////////////////////


Arquivo- menu_main.xml ..\app\src\main\res\menu\menu_main.xml


<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="projeto.meu.com.meuprojeto.MainActivity">
    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:title="@string/action_settings"
        app:showAsAction="never" />
</menu>


//////////////////////////////////////////////////////////////////////


Arquivo- colors.xml ..\app\src\main\res\values\colors.xml


<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#000000</color>
    <color name="colorPrimaryDark">#000000</color>
    <color name="colorAccent">#000000</color>
</resources>


//////////////////////////////////////////////////////////////////////


Arquivo- dimens.xml ..\app\src\main\res\values\dimens.xml


<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <dimen name="fab_margin">16dp</dimen>
</resources>


//////////////////////////////////////////////////////////////////////


Arquivo- strings.xml ..\app\src\main\res\values\strings.xml


<resources>
    <string name="app_name">Meu Projeto</string>
    <string name="action_settings">Settings</string>
<string name="hello_world">Hello World</string>
</resources>


//////////////////////////////////////////////////////////////////////


Arquivo- styles.xml ..\app\src\main\res\values\styles.xml


<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>


//////////////////////////////////////////////////////////////////////



Nenhum comentário:

Postar um comentário

Obrigado por comentar, volte sempre!

Seguidores

Pages




Ajude continuar nossos projetos.    

Copie este código: [[address]]

Donation of [[value]] BTC Received. Thank You.
[[error]]






Copiado