1. 程式人生 > >Android開發之計算器(一)介面設計之activity_main佈局檔案

Android開發之計算器(一)介面設計之activity_main佈局檔案

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    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" android:orientation="vertical" tools:context="com.sesametech.mazyi.calculateapp.MainActivity"
> <EditText android:id="@+id/edittext" android:gravity="right" android:hint="0" android:textColorHint="#000000" android:layout_width="fill_parent" android:layout_height="wrap_content" android:selectAllOnFocus="false" android:textAppearance
="@style/TextAppearance.AppCompat.Large" android:inputType="none"/> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/clear" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="C" android:background="#307Dee"/> <Button android:id="@+id/del" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="DEL"/> <Button android:id="@+id/div" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="/"/> <Button android:id="@+id/multi" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="*"/> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/seven" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="7"/> <Button android:id="@+id/eight" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="8"/> <Button android:id="@+id/nine" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="9"/> <Button android:id="@+id/minus" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="-"/> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/four" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="4"/> <Button android:id="@+id/five" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="5"/> <Button android:id="@+id/six" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="6"/> <Button android:id="@+id/plus" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="+"/> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/one" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="1"/> <Button android:id="@+id/two" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="2"/> <Button android:id="@+id/three" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="3"/> <Button android:id="@+id/parenthesis" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="( )"/> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginBottom="0dp"> <Button android:id="@+id/zero" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="0"/> <Button android:id="@+id/dot" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="."/> <Button android:id="@+id/plusorminus" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="+/-"/> <Button android:id="@+id/equals" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:text="=" android:background="#F07D22"/> </LinearLayout> </LinearLayout>

相關推薦

Android開發計算器介面設計activity_main佈局檔案

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schem

Android開發計算器介面設計

        計算器開發主要涉及到LinearLayout佈局、EditText、Button的使用。為android入門基礎內容。 開啟android studio選擇建立一個新的工程,應用程式的名稱為CalculateApp,公司域可以設定,也可以不設定,我設定的如圖所示 點選“next”,選擇支援的最

Android牟利--介面嵌入有米廣告

經過了一番折騰,忙忙碌碌了一下午,終於搞明白了Android軟體介面嵌入廣告的方法,以下我以嵌入有米廣告為例小結一下: 步驟一,下載有米廣告SDK,將 youmi-android.jar 匯入想要嵌

Android開發 - 掌握ConstraintLayout傳統布局的問題

ttext 指定 面對復雜 簡單的 技術分享 改變 out jpg 並且 在傳統的Android開發中,頁面布局占用了我們很多的開發時間,而且面對復雜頁面的時候,傳統的一些布局會顯得非常復雜,每種布局都有特定的應用場景,我們通常需要各種布局結合起來使用來實現復雜的頁面。隨著

android開發系列教程啟動頁

1.啟動頁延時跳轉+沉浸狀態列+啟動頁圖片全屏 public class SplashActivity extends AppCompatActivity { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

Android開發問題總結

2016.09.08 io.reactivex.exception.UndeliverableException 如上圖所示,在使用okhttp時遇到的問題,原因是logging-inter

Android開發--便籤

我的上一篇部落格http://blog.csdn.net/callmesp/article/details/52895630 講的是ListView和RecyclerView,起因就是想開發一個便籤的時候才遇到的問題。在學習了RecyclerView之後

android 開發問題集:SDK更新後 執行程式報錯Location of the Android SDK has not been setup in the preferences

問題描述:android跟新後報錯location of the android sdk has not been setup in the preferences。eclipse裡的SDK Manager也打不開 原因:android跟新後ADT的版本過低造成的,但是有的人又因為跟新ADT失敗導致,也

大疆無人機Android版SDK開發踩坑----前言

  最近一段時間一直在做大疆無人機安卓版開發,這水也是挺深的,不仔細看官網SDK的介紹就會遇到各種各樣的坑,簡單記錄一下,希望可以讓其他人少走一些彎路。   安卓端用到的SDK大概有兩種:Android SDK和Android UX SDK   Android SDK(官網介紹):   開發人員可以通過SDK

Android開發RecyclerView初步使用

首先要感謝前面的大佬們的總結,給了我站在巨人肩膀上的機會。文中有不對的地方還望大佬指出,如有大佬覺的侵權的地方還望指出,鄙人將以最快速度修改!好了,話不多少了,開始開車! 第一步:匯入RecyclerView compile 'com.android.support:re

python開發

數字 美團 其中 class 翻譯 電視 ... 硬件 算數運算 一、python基礎入門 1、編程語言 程序員與計算機溝通的語言就叫做編程語言 編程語言發展至今經歷了以下: ①.機器語言:站在計算機(奴隸)的角度,說計算機能聽懂的語言,那就是直接用二進制編程,直接操作

Android註冊程式編寫圖解程式設計

Android註冊程式編寫(一) (作者:Baron_wu 禁止轉載) 介面設計 首先進入Androidstudio建立一個空的工程: 選擇要執行的裝置: 選擇一個空的活動: 為app命名: 之後進入主介面: 點選紅筆畫中的視窗進入介面設計視窗: 介面設計視窗如下

Android--四大元件Activity

####1. Activity是什麼? ####2. 生命週期 ######1). Activity跳轉 ######2). 從後臺啟動 ######3). 橫豎屏切換 ####3. 啟動模式 ######1). 任務棧 ######2). laucherMode ######3).

Android四大元件ContentProvider

1.什麼是ContentProvider? 內容提供程式管理對資料結構化資料集的訪問。它們封裝資料,並提供用於定義資料安全性的機制。內容提供者是連線一個程序中的資料與另一個程序中執行的程式碼的標準介面。 是不同應用程式之間進行資料交換的標準API,以某種Uri的形式對外提供資料,

Android Studio開發小技巧

我們都知道,Android Studio的功能是非常強大的,也是很智慧的。如果有人告訴你學Android開發要用命令列,你可以告訴他Android Studio是谷歌提供給開發者提升效率的。試想想你腦袋裡有一堆想法,但是開發編碼效率太低導致想法都丟失了或者興趣消失了多可怕對不。好了廢話不多說,這裡介

Android自動化uiautomator

一、uiautomator簡介 Android SDK提供下述工具來支援自動化的功能介面測試: 1、uiautomatorviewer:掃描、分析待測應用的UI元件的影象工具。 2、uiautomator:包含建立定製功能介面測試API和自動化執行測試用例的引擎的JAV

Android 控制元件 RecyclerView—— 載入檢視和佈局選擇

本文目錄 一、概述 二、列表檢視的處理 1. item 的佈局檔案 2. 構造 Adapter 類 3. 佈局管理器 1)LinearLayoutManager 2)GridLayoutManager

開發必備工具Git

目錄 一、什麼是Git 答:Git是一個分散式版本控制軟體。另外提一句,它的開發者就是大名鼎鼎的Linux之父Linus。 版本控制,顧名思義,是一種在開發的過程中用於管理我們對檔案、目錄或工程等內容的修改歷史,方便檢視更改歷史記錄,備份以便恢復以前的版本的技術。(“後悔藥”) 分散式,是一種版本控制的方式

安卓開發學習筆記:如何用Android Stuidio匯出apk檔案

一,首先,我們在選單欄上找到這一欄: 然後點選build,再點選generate apk,然後出現以下介面: 由於之前我們並沒有進行apk檔案的生成,因此需要這個apk key做一個驗證,以防您的app上線之後被別人盜用,同時證明自己對這個app的擁有權。key store path就是您app key所

web前端進化——小程式開發

最近學習前端感覺很多知識學起來容易,但是很多知識點很容易忘記,想做一個工具來方便自己來學習,正好結合小程式,分享給大家。照顧初學者,可能講的比較細,理解哈。 準備工具 小程式一個 已申請(名稱是:we