PIXNET Logo登入

mingyilai的部落格

跳到主文

歡迎光臨mingyilai在痞客邦的小天地

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 8月 15 週一 201610:27
  • [Android]Class_BMI

res/layou/activity_main.xml
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.lai.class_bmi.MainActivity">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textSize="20sp"
android:text="@string/height"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textSize="20sp"
android:id="@+id/editText" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="@string/weight"
android:layout_margin="10dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textSize="20sp"
android:id="@+id/editText2" />
</LinearLayout>
<!--android:onClick="onCaculate"是第五種方法-->
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/submit"
android:layout_gravity="center"
android:onClick="onCaculate"
android:id="@+id/button" />
</LinearLayout>
(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(7)

  • 個人分類:Android
▲top
  • 8月 15 週一 201610:19
  • [Android]Class2_order_點餐

res/layou/activity_main.xml
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/pic"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.lai.class3_order.MainActivity">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tableNumber"
android:textSize="@dimen/BigText"
android:textColor="@color/colorAccent"
android:id="@+id/textView" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editText" />
</LinearLayout>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_margin="20dp"
android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/BigText"
android:text="@string/normal"
android:textColor="@color/colorAccent"
android:id="@+id/radioButton" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/BigText"
android:textColor="@color/colorAccent"
android:text="@string/vip"
android:id="@+id/radioButton2" />
</RadioGroup>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/meal"
android:textSize="@dimen/BigText"
android:layout_gravity="center_horizontal"
android:id="@+id/textView2" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:layout_margin="20dp"
android:layout_height="wrap_content">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:textSize="@dimen/BigText"
android:text="@string/ameal"
android:id="@+id/checkBox" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:text="@string/bmeal"
android:textSize="@dimen/BigText"
android:id="@+id/checkBox2"
android:checked="false" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:layout_margin="20dp"
android:layout_height="wrap_content">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:textSize="@dimen/BigText"
android:text="@string/cmeal"
android:id="@+id/checkBox3" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:textSize="@dimen/BigText"
android:text="@string/dmeal"
android:id="@+id/checkBox4" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@color/colorAccent"
android:textSize="@dimen/BigText"
android:text="@string/beverage"
android:id="@+id/textView3" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:textSize="@dimen/BigText"
android:text="@string/tea"
android:id="@+id/radioButton3" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:textSize="@dimen/BigText"
android:text="@string/coffee"
android:id="@+id/radioButton4" />
</RadioGroup>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="20dp"
android:textColor="@color/colorAccent"
android:textSize="@dimen/BigText"
android:text="@string/submit"
android:id="@+id/button" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@color/colorAccent"
android:textSize="@dimen/BigText"
android:text="@string/totalMoney"
android:padding="20dp"
android:id="@+id/textView4" />
</LinearLayout>
(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(6)

  • 個人分類:Android
▲top
  • 8月 15 週一 201610:12
  • [Android]Class1_美金台幣轉換

package net.macdidi.class1_exchange;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
EditText etInput;
TextView tvShow;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findviews();
}
void findviews(){
etInput=(EditText)findViewById(R.id.editText);
tvShow=(TextView)findViewById(R.id.textView3);
//1.建立元件
btn=(Button)findViewById(R.id.button);
//3.註冊監聽器
btn.setOnClickListener(btnListener);
//第三種
// btn.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
// }
// });
//第四種
// btn.setOnClickListener(this);
}
//2.建立監聽器(匿名內部類)最常用的一種
View.OnClickListener btnListener=new View.OnClickListener() {
@Override
public void onClick(View v) {
double usd=0;
String strUsd=etInput.getText().toString();
try {
usd = Double.parseDouble(strUsd);
}catch(NumberFormatException e){
e.printStackTrace();
Toast.makeText(MainActivity.this,"輸入數字格式不正確", Toast.LENGTH_SHORT).show();
//(this指所在類別的物件,要顯示的文字,出現時間)
}
double twd=usd*30.0;
tvShow.setText(String.valueOf(twd));
}
};
@Override
public void onClick(View v) {
}
//配合第四種
// @Override
// public void onClick(View v) {
//
// }
//第二種
// class BtnClick implements View.OnClickListener{
//
// @Override
// public void onClick(View v) {
//
// }
// };
}
(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(37)

  • 個人分類:Android
▲top
  • 4月 13 週三 201619:34
  • [Java]Properties設定和取得屬性


package pkg13.pkg50;
import java.util.Properties;
(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(343)

  • 個人分類:Java
▲top
  • 4月 13 週三 201619:01
  • [Java]用Map增加和取得內容/使用Iterator介面輸出集合內容


package pkg13.pkg26;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(320)

  • 個人分類:Java
▲top
  • 4月 11 週一 201621:21
  • [Java]Set介面(HashSet/TreeSet)

 allSet.add("aa");
        allSet.add("aa");
        allSet.add("bb");

(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(27)

  • 個人分類:Java
▲top
  • 4月 11 週一 201619:57
  • [Java]List增加/刪除資料的操作


package pkg13.pkg1;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(1,834)

  • 個人分類:Java
▲top
  • 4月 06 週三 201620:19
  • [Java]同步與鎖死

一個多執行緒的程式如果是透過Runnable介面實現的,則表示類別中的屬性將被多個執行緒共用。
package pkg9.pkg19;
(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(148)

  • 個人分類:Java
▲top
  • 4月 06 週三 201620:18
  • [Java]執行緒的禮讓


package pkg9.pkg8;
import com.sun.istack.internal.logging.Logger;
import java.util.logging.Level;
(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(18)

  • 個人分類:Java
▲top
  • 4月 06 週三 201620:02
  • [Java]測試執行緒優先順序


package pkg9.pkg8;
import com.sun.istack.internal.logging.Logger;
import java.util.logging.Level;
(繼續閱讀...)
文章標籤

mingyilai 發表在 痞客邦 留言(0) 人氣(516)

  • 個人分類:Java
▲top
«1234...6»

個人資訊

mingyilai
暱稱:
mingyilai
分類:
數位生活
好友:
累積中
地區:

熱門文章

  • (8,149)[Java]BMI換算
  • (2,117)[PHP]繼承-override
  • (1,031)Katalon 自學網站
  • (615)[SourceTree]遇到 Thsi is not a valid source path / URL
  • (12)電腦版skype雙開方式

Java

toggle Android (1)
  • Android (5)
  • Python (1)
  • 自動化測試 (2)
  • 鐵人三項 (4)
  • PHP (8)
  • Java (34)
  • 未分類文章 (1)

最新文章

  • [Python]三角形排列
  • [Java]浮點數的精確度問題
  • 電腦版skype雙開方式
  • [SourceTree]遇到 Thsi is not a valid source path / URL
  • Katalon 自學網站
  • [LAMP]CentOS-7+Apache+MySQL+PHP7.0+phpmyadmin
  • 中華電信雙np流程
  • [PHP]表單元素
  • [PHP]命名空間
  • [PHP]抽象方法

最新留言

  • [20/03/21] GENE  於文章「中華電信雙np流程...」留言:
    瓦的中華999 真的盤 也要來去辦雙NP嚕 不過移入台...
  • [20/01/30] 訪客 於文章「中華電信雙np流程...」留言:
    很詳細的流程,感謝分享~ 我是中華電信15年的老客戶,老客...
  • [19/09/28] 訪客 於文章「中華電信雙np流程...」留言:
    很 贊的分享 ~ 跟 人一樣,老了不值錢; 常 NP 成...

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣: