Last active
July 28, 2018 10:41
-
-
Save zrks/34e2941ee7b957f1fb2068331fd754de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.constraint.ConstraintLayout 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" | |
| app:layout_behavior="@string/appbar_scrolling_view_behavior" | |
| tools:context=".MainActivity" | |
| tools:showIn="@layout/activity_main"> | |
| <Button | |
| android:id="@+id/button5" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginStart="60dp" | |
| android:layout_marginTop="140dp" | |
| android:text="1" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toTopOf="parent" /> | |
| <Button | |
| android:id="@+id/button2" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginTop="140dp" | |
| android:text="2" | |
| app:layout_constraintStart_toEndOf="@+id/button5" | |
| app:layout_constraintTop_toTopOf="parent" /> | |
| <Button | |
| android:id="@+id/button3" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginEnd="8dp" | |
| android:layout_marginTop="140dp" | |
| android:text="3" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintHorizontal_bias="0.0" | |
| app:layout_constraintStart_toEndOf="@+id/button2" | |
| app:layout_constraintTop_toTopOf="parent" /> | |
| <Button | |
| android:id="@+id/button6" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginEnd="8dp" | |
| android:text="6" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintHorizontal_bias="0.0" | |
| app:layout_constraintStart_toEndOf="@+id/button8" | |
| app:layout_constraintTop_toBottomOf="@+id/button3" /> | |
| <Button | |
| android:id="@+id/button8" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:text="5" | |
| app:layout_constraintStart_toEndOf="@+id/button7" | |
| app:layout_constraintTop_toBottomOf="@+id/button2" /> | |
| <Button | |
| android:id="@+id/button7" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginStart="60dp" | |
| android:text="4" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toBottomOf="@+id/button5" /> | |
| <Button | |
| android:id="@+id/button9" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginStart="60dp" | |
| android:text="7" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toBottomOf="@+id/button7" /> | |
| <Button | |
| android:id="@+id/button10" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:text="8" | |
| app:layout_constraintStart_toEndOf="@+id/button9" | |
| app:layout_constraintTop_toBottomOf="@+id/button8" /> | |
| <Button | |
| android:id="@+id/button11" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginEnd="8dp" | |
| android:text="9" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintHorizontal_bias="0.0" | |
| app:layout_constraintStart_toEndOf="@+id/button10" | |
| app:layout_constraintTop_toBottomOf="@+id/button6" /> | |
| <Button | |
| android:id="@+id/button12" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginBottom="8dp" | |
| android:layout_marginStart="60dp" | |
| android:text="0" | |
| app:layout_constraintBottom_toBottomOf="parent" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toBottomOf="@+id/button9" | |
| app:layout_constraintVertical_bias="0.0" /> | |
| <Button | |
| android:id="@+id/button13" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginBottom="8dp" | |
| android:text="." | |
| app:layout_constraintBottom_toBottomOf="parent" | |
| app:layout_constraintStart_toEndOf="@+id/button12" | |
| app:layout_constraintTop_toBottomOf="@+id/button10" | |
| app:layout_constraintVertical_bias="0.0" /> | |
| <Button | |
| android:id="@+id/button14" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" | |
| android:layout_marginBottom="8dp" | |
| android:layout_marginEnd="8dp" | |
| android:text="=" | |
| app:layout_constraintBottom_toBottomOf="parent" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintHorizontal_bias="0.0" | |
| app:layout_constraintStart_toEndOf="@+id/button13" | |
| app:layout_constraintTop_toBottomOf="@+id/button11" | |
| app:layout_constraintVertical_bias="0.0" /> | |
| </android.support.constraint.ConstraintLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.marcis.myapplication.feature; | |
| import android.os.Bundle; | |
| import android.support.design.widget.FloatingActionButton; | |
| import android.support.design.widget.Snackbar; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.support.v7.widget.Toolbar; | |
| import android.view.View; | |
| import android.view.Menu; | |
| import android.view.MenuItem; | |
| import android.widget.Button; | |
| import android.widget.TextView; | |
| public class MainActivity extends AppCompatActivity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.content_main); | |
| final TextView result = (TextView) findViewById(R.id.resultView); | |
| Button buttonOne = (Button) findViewById(R.id.button5); | |
| buttonOne.setOnClickListener(new View.OnClickListener() { | |
| @Override | |
| public void onClick(View view) { | |
| result.setText("1"); | |
| } | |
| }); | |
| } | |
| @Override | |
| public boolean onCreateOptionsMenu(Menu menu) { | |
| // Inflate the menu; this adds items to the action bar if it is present. | |
| getMenuInflater().inflate(R.menu.menu_main, menu); | |
| return true; | |
| } | |
| @Override | |
| public boolean onOptionsItemSelected(MenuItem item) { | |
| // Handle action bar item clicks here. The action bar will | |
| // automatically handle clicks on the Home/Up button, so long | |
| // as you specify a parent activity in AndroidManifest.xml. | |
| int id = item.getItemId(); | |
| //noinspection SimplifiableIfStatement | |
| if (id == R.id.action_settings) { | |
| return true; | |
| } | |
| return super.onOptionsItemSelected(item); | |
| } | |
| // N.B. My custom feature. | |
| public void clickMe(View view) { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment