zoukankan      html  css  js  c++  java
  • android学习笔记06(第一个程序)

    java类:

    package tk.myactivity;
    
    import android.os.Bundle; 
    import android.app.Activity; 
    import android.view.Menu; 
    import android.widget.Button; 
    import android.widget.TextView;
    
    public class TK_Activity01 extends Activity {
    
        @Override 
        public void onCreate(Bundle savedInstanceState) { 
            super.onCreate(savedInstanceState); 
            setContentView(R.layout.activity_tk__activity01); 
            TextView myTextView=(TextView)findViewById(R.id.myTextView); 
            Button myButton=(Button)findViewById(R.id.myButton); 
            myTextView.setText("我的第一个Textview"); 
            myButton.setText("我的第一个Button" "\n" "test"); 
        }
    
        @Override 
        public boolean onCreateOptionsMenu(Menu menu) { 
            getMenuInflater().inflate(R.menu.activity_tk__activity01, menu); 
            return true; 
        } 
    }

    xml文件:

    <RelativeLayout 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" >
    
        <TextView 
            android:id="@ id/myTextView" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_centerHorizontal="true" 
            android:layout_centerVertical="true" 
            tools:context=".TK_Activity01" /> 
        <Button 
            android:id="@ id/myButton" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            /> 
    </RelativeLayout>
  • 相关阅读:
    数字签名(代码签名)流程
    (转)__cdecl __fastcall与 __stdcall
    装修主材
    ATL 获取flash信息
    Windows结构化异常
    格式化HRESULT获取对应文本
    which type of VS files should be committed into a version control system
    读Windows核心编程-5-作业
    IE WebBrowser事件触发
    Windows 结构化异常
  • 原文地址:https://www.cnblogs.com/tiankonguse/p/2610790.html
Copyright © 2011-2022 走看看