zoukankan      html  css  js  c++  java
  • Android经常使用UI组件

    TextView是Android里面用的最多的UI组件,一般使用在须要显示一些信息的时候,其不能输入,仅仅能初始设定或者在程序中改动。

    实例:TextViewDemo
    执行效果:

    代码清单:
    布局文件:main.xml
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="这里是TextView,你能够在这里显示一些文本信息。"
        />
    </LinearLayout>
    
    Java源码文件:MainActivity.java
    package com.rainsong.textviewdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    public class MainActivity extends Activity
    {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
        }
    }
    


    API知识点
    Activity
    public class
    Activity
    extends ContextThemeWrapper
    implements ComponentCallbacks2 KeyEvent.Callback LayoutInflater.Factory2 View.OnCreateContextMenuListener Window.Callback

    Known Direct Subclasses
    AccountAuthenticatorActivity, ActivityGroup, AliasActivity, ExpandableListActivity, FragmentActivity, ListActivity, NativeActivity

    Known Indirect Subclasses
    LauncherActivity, PreferenceActivity, TabActivity

    void setContentView(int layoutResID)
    Set the activity content from a layout resource.

    TextView
    public class
    TextView
    extends View
    implements ViewTreeObserver.OnPreDrawListener

    Known Direct Subclasses
    Button, CheckedTextView, Chronometer, DigitalClock, EditText, TextClock

    Known Indirect Subclasses
    AutoCompleteTextView, CheckBox, CompoundButton, ExtractEditText, MultiAutoCompleteTextView, RadioButton, Switch, ToggleButton

    Class Overview
    Displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing; see EditText for a subclass that configures the text view for editing.

    Public Constructors
    TextView(Context context)
    TextView(Context context, AttributeSet attrs)
    TextView(Context context, AttributeSet attrs, int defStyle)

  • 相关阅读:
    Web调用Linux客户端remmina运维
    前端和后端连载一起启动
    react redux 二次开发流程
    快上车,react 入门拾遗
    吐血整理!这篇带你彻底理解主存中存储单元地址的分配
    大学四年走来,这些网络工程师必备的模拟器我都给你整理好了
    主存、辅存、内存、外存、存储器是什么?还傻傻分不清楚?看完这一篇就够了
    一分钟理解系列—半导体存储芯片的知识点总结
    小白入门NAS—快速搭建私有云教程系列(一)
    五分钟理解主存储器的基本组成结构
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/4081000.html
Copyright © 2011-2022 走看看