Latest posts

android, Android UI控件

Anroid OptionMenu 创建

package com.example.uitest2; import android.R.menu; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends Activity { private static final int ITEM1=Menu.FIRST; private static final int ITEM2=Menu.FIRST+1; private static final int ITEM3=Menu.FIRST+2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);...

android, Android UI控件

Android Spinner控件的一种使用方法

Android Spinner控件的一种使用方法 发表于1年前(2013-01-07 22:20)   阅读(157) | 评论(0) 0人收藏此文章, 我要收藏 赞0     Spinner控件可以弹出下拉框,选择下拉菜单中的一项。记录一种使用Spinner控件的方法。 1.在main.xml文件中定义Spinner控件 <Spinner android:id="@+id/spinner_01" android:layout_width="wrap_content" android:layout_height="wrap_content" > </Spinner>  2.在MainActivity中,给Spinner控件设置Adapter。 Spinner spinner = (Spinner) findViewById(spinnerId); ArrayAdapter spinneradapter = ArrayAdapter.createFromResource( getApplicationContext(), textArrayResId, R.layout.spinner); spinneradapter.setDropDownViewResource(R.layout.spinner1); spinner.setAdapter(spinneradapter); spinner.setVisibility(View.VISIBLE); ①其中, ArrayAdapter.createFromResource(Context,int,int)这个方法的定义如下: Creates a new ArrayAdapter from external resources. The content...

Android UI控件

按键 – Buttons -Anroid UI

Buttons 原文地址:http://docs.eoeandroid.com/guide/topics/ui/controls/button.html 译文地址:http://wiki.eoeandroid.com/Buttons 目录 1 按键 - Buttons 1.1 点击事件的响应 - Responding to Click Events 1.1.1 使用监听器 - Using an OnClickListener 1.2 按钮的样式 - Styling Your Button 1.2.1 无边框按钮 - Borderless button 1.2.2 定制背景 - Custom background 按键 - Buttons 按钮包括文字或者图标,或者两者兼而有之,当用户触摸到按钮时就会触发事件。 取决于你需要按钮有文本、图标或两者兼而有之,您可以以三种方式创建按钮布局: 需要有文字的按钮,使用<Button>类: <Button android:layout_width="wrap_content" android:layout_height="wrap_content"...

android, Android UI控件

Text Fields-文本框

Text Fields-文本框 主任务原文链接:http://docs.eoeandroid.com/guide/topics/ui/controls/text.html 目录 1 Text Fields-文本框 1.1 Specifying the Keyboard Type-指定键盘类型 1.1.1 Controlling other behaviors-控制其他行为 1.2 Specifying Keyboard Actions-指定键盘操作 1.2.1 Responding to action button events-响应按钮事件 1.2.2 Setting a custom action button label-设置文本框标签 1.3 Adding Other Keyboard Flags-添加其他键盘标志 1.4 Providing Auto-complete Suggestions-提供自动完成建议 A text field allows the user...

Non classé

隐性intent 用法

1. 在 mainActivity.java 中 package androidcour2; import javax.security.auth.PrivateCredentialPermission; import com.example.androidcour2.R; import android.R.anim; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity implements OnClickListener { private Button btn1; @Override protected void onCreate(Bundle savedInstanceState)...

android

用Eclipse编写Android程序的代码提示功能

用Eclipse编写Android程序的代码提示功能主要是在java和xml文件中,有时候会失效,默认的提示功能有限。 1)java文件自动提示 Window->Preferences->Java->Editor->Content Assist->Auto Activation 将Auto activation triggers for Java中的默认的一点替换为.abcdefghijklmnopqrstuvwxyz(, 2)xml文件自动提示 Window->Preferences->XML->XML Files->Editor->Content Assist->Auto Activation 将Prompt when these characters are inserted中的<=:替换为<=:.abcdefghijklmnopqrstuvwxyz(, 若以上设置都不管用或者java中点号后没有提示,则可重新建立个Workspace试试。