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>
  • 相关阅读:
    魔改版BBR
    termux 开启 sshd
    Basic berkeley socket functions
    mosh
    XOR 加密
    指定so动态链接库连接器
    UTF8 UTF16 之间的互相转换
    MySQL C API概述
    C JAVA你可能不知道的那些编程细节
    虚拟内存
  • 原文地址:https://www.cnblogs.com/tiankonguse/p/2610790.html
Copyright © 2011-2022 走看看