當前位置:編程學習大全網 - 源碼下載 - Android布局,用LinearLayout做如下計算器界面,可按屏幕大小變換比例

Android布局,用LinearLayout做如下計算器界面,可按屏幕大小變換比例

<?xml?version="1.0"?encoding="utf-8"?>

<LinearLayout?xmlns:android="/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"?>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="75dp"

android:orientation="horizontal"?>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="1"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="2"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="3"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="/"?/>

</LinearLayout>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="75dp"

android:orientation="horizontal"?>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="4"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="5"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="6"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="*"?/>

</LinearLayout>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="75dp"

android:orientation="horizontal"?>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="7"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="8"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="9"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="-"?/>

</LinearLayout>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="150dp"

android:orientation="horizontal"?>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:orientation="vertical"?>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:orientation="horizontal"?>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="0"?/>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="2"

android:text="."?/>

</LinearLayout>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:text="="?/>

</LinearLayout>

<Button

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="3"

android:text="+"?/>

</LinearLayout>

</LinearLayout>

  • 上一篇:蘋果怎麽看ios系統版本
  • 下一篇:網站估價系統源代碼
  • copyright 2024編程學習大全網