摘要:
表格布局中每一行为一个TableRow对象,当然也可以是一个View对象。TableRow可以添加子控件,每添加个为一列。anroid:layout_column:控件在TableRow中所处的列android:layout_span:该控件所跨越的列数android:collapseColumns:将里面指定的列隐藏,若有多列需要隐藏,用逗号将列序号隔开。android:stretchColumns:设置指定的列为可伸展的列,该列会尽量伸展以填满所有可用的空间,若有多列需要设置为可伸展,需要用逗号隔开.示例:<TableLayout xmlns:android="http:/ 阅读全文
摘要:
一:TableLayout是表格布局先上例子:定义一个xml布局文件tablelayout.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:l 阅读全文
摘要:
Toast是Android中用来显示显示信息的一种机制,和Dialog不一样的是,Toast是没有焦点的,而且Toast显示的时间有限,过一定的时间就会自动消失。1.默认效果:代码:Toast.makeText(getApplicationContext(), "默认Toast样式",Toast.LENGTH_SHORT).show();2.自定义显示位置效果:代码:toast = Toast.makeText(getApplicationContext(),"自定义位置Toast", Toast.LENGTH_LONG);toast.setGravit 阅读全文
摘要:
这几天做项目,用到背景选择器,无论怎么弄,都没有效果,找了很多资料都没有找到,样式是这样的<?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/title_new_normal"/> <item android:drawable="@d 阅读全文
摘要:
最近做listview和button都要改变Android原来控件的背景,在网上查找了一些资料不是很全,所以现在总结一下android的selector的用法。首先android的selector是在drawable/xxx.xml中配置的。先看一下listview中的状态:把下面的XML文件保存成你自己命名的.xml文件(比如list_item_bg.xml),在系统使用时根据ListView中的列表项的状态来使用相应的背景图片。drawable/list_item_bg.xml<?xml version="1.0" encoding="utf-8&quo 阅读全文
摘要:
通过使用RadioGroup的button属性后怎么让radiobutton 显示的图片居中.使用android:backgroud方法图片会变形。无奈使用android:drawableTop.但是该图片是靠右侧的。而网上说的android:button="@null"android:drawableTop="@drawable/rate_selector" 这个方法试过了,没用如下面的例子:<RadioButton android:id="@+id/radio_button3" style="@style/main 阅读全文
摘要:
context.getResources().getString(int id)或者getString(int id,Object ...obj) 阅读全文
摘要:
Inflater英文意思是膨胀,在Android中应该是扩展的意思吧。 LayoutInflater的作用类似于 findViewById(),不同点是LayoutInflater是用来找layout文件夹下的xml布局文件,并且实例化!而 findViewById()是找具体某一个xml下的具体 widget控件(如:Button,TextView等)。她可以有很多地方可以使用,如BaseAdapter的getView中,自定义Dialog中取得view中的组件widget等等。它的用法有2种:LayoutInflater inflater = LayoutInflater.from(thi 阅读全文