首页 文章 精选 留言 我的

精选列表

搜索[API测试],共10000篇文章
优秀的个人博客,低调大师

Android 中文 API (17) —— TextSwitcher

正文 一、结构 public classTextSwitcherextendsViewSwitcher java.lang.Object android.view.View android.view.ViewGroup android.widget.FrameLayout android.widget.ViewAnimator android.widget.ViewSwitcher android.widget.TextSwitcher 二、类概述 ViewSwitcher仅仅包含子类型TextView。TextSwitcher被用来使屏幕上的label产生动画效果。每当setText(CharSequence)被调用时,TextSwitcher使用动画方式将当前的文字内容消失并显示新的文字内容。(译者注:改变文字时增加一些动画效果) 三、构造函数 public TextSwitcher (Context context) 创建一个新的空TextSwitcher 参数 context应用程序上下文 public TextSwitcher (Context context, AttributeSet attrs) 使用提供的context和attributes来创建一个空的TextSwitcher 参数 context应用程序环境 attrs属性集合 四、公共方法 public void addView (View child, int index, ViewGroup.LayoutParams params) 根据指定的布局参数新增一个子视图 参数 child新增的子视图 index新增子视图的位置 params新增子视图的布局参数 抛出异常 IllegalArgumentException当子视图不是一个TextView实例时 public void setCurrentText (CharSequence text) 设置当前显示的文本视图的文字内容。非动画方式显示。 参数 text需要显示的新文本内容 public void setText (CharSequence text) 设置下一视图的文本内容并切换到下一视图。可以动画的退出当前文本内容,显示下一文本内容。 参数 text需要显示的新文本内容 五、代码示例 5.1 摘自APIDemos->View->TextSwitcher 5.1.1 Java public class TextSwitcher1 extends Activity implements ViewSwitcher.ViewFactory, View.OnClickListener{ private TextSwitchermSwitcher; private int mCounter = 0 ; @Override protected void onCreate(BundlesavedInstanceState){ super .onCreate(savedInstanceState); setContentView(R.layout.text_switcher_1); mSwitcher = (TextSwitcher)findViewById(R.id.switcher); mSwitcher.setFactory( this ); Animationin = AnimationUtils.loadAnimation( this , android.R.anim.fade_in); Animationout = AnimationUtils.loadAnimation( this , android.R.anim.fade_out); mSwitcher.setInAnimation(in); mSwitcher.setOutAnimation(out); ButtonnextButton = (Button)findViewById(R.id.next); nextButton.setOnClickListener( this ); updateCounter(); } public void onClick(Viewv){ mCounter ++ ; updateCounter(); } private void updateCounter(){ mSwitcher.setText(String.valueOf(mCounter)); } public ViewmakeView(){ TextViewt = new TextView( this ); t.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); t.setTextSize( 36 ); return t; } } 5.1.2 XML <? xmlversion="1.0"encoding="utf-8" ?> < LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android" android:layout_width ="match_parent" android:layout_height ="match_parent" android:orientation ="vertical" > < Button android:id ="@+id/next" android:layout_width ="wrap_content" android:layout_height ="wrap_content" android:text ="@string/text_switcher_1_next_text" /> < TextSwitcher android:id ="@+id/switcher" android:layout_width ="match_parent" android:layout_height ="wrap_content" /> </ LinearLayout > 本文转自over140 51CTO博客,原文链接:http://blog.51cto.com/over140/582684,如需转载请自行联系原作者

优秀的个人博客,低调大师

Android 中文API (33) —— Checkable

正文 一、结构 public interfaceCheckable 间接子类 CheckBox,CheckedTextView, CompoundButton,RadioButton,ToggleButton 二、概述 此接口定义了一个扩展,使得继承它的视图控件具有可选状态属性。 (译者注:凡是继承了此接口的类,便有了android:checked属性 三、公共方法 public abstract boolean isChecked () 查询当前视图控件的选中状态。 返回: 返回一个boolean的值来表示当前视图控件的选中状态,如果当前控件被选中,返回true值,否则返回false值。 (译者注:并不一定是控件上显示了对号或者点就是被选中,很可能某个思维不同于常人的程序员会把有对号的定义为未选中而返回一个false。当然这只是可能,按照常理来说还是有对号和点的表示选中true,反之亦然。) public abstract void setChecked (boolean checked) 设置当前视图控件的选中状态。(译者注: 执行前 执行 执行后 任何状态 setChecked(true) 选中 任何状态 setChecked(false) 未选中 参数: checked指定控件的选中状态true表示设置为选中,false为未选中。 public abstract void toggle () 此方法用来切换当前视图控件的选中状态。(译者注:即将视图控件的当前状态变为其相反状态 执行前 执行 执行后 选中 toggle() 未选中 未选中 toggle() 选中 本文转自over140 51CTO博客,原文链接:http://blog.51cto.com/over140/582641,如需转载请自行联系原作者

优秀的个人博客,低调大师

Android中文API(118)——FilterQueryProvider

正文 一、结构 public interfaceFilterQueryProvider android.widget.FilterQueryProvider 二、概述 这个类可以被CursorAdapter和CursorTreeAdapter用来定义如何过滤适配器的内容。 参见 runQuery(CharSequence) 三、公共方法 public abstract CursorrunQuery(CharSequence constraint) 执行指定约束条件的过滤查询。这个查询要求通过过滤器将结果附加到适配器。约定:当约束条件为null或者空时,都必须返回过滤前的原始结果。(译者注:可以在这个方法里根据条件使用Like等语句执行SQL查询) 参数 constraint必须被过滤的查询约束条件 返回值 代表新查询结果的 Cursor (游标) 本文转自over140 51CTO博客,原文链接:http://blog.51cto.com/over140/582348,如需转载请自行联系原作者

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册
修改密码
忘记密码