androiditem属性
❶ android中自定义主题,在style下的item项中有关于自定义窗口name属性都有哪些,及这些属性的取值。谢谢!
<item name="android:textAppearance">?android:attr/textAppearance</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:textSize">16dp</item>
<item name="android:windowEnterAnimation">@*android:anim/grow_fade_in_from_bottom</item>
<item name="android:windowExitAnimation">@*android:anim/shrink_fade_out_from_bottom</item>
<item name="android:fontFamily">sans-serif-light</item>
<item name="android:textAllCaps">true</item>
这些是在4.1系统源码下的UI里面的Style.xml中的一些,支持 普通的属性,信息不全,要全部的那些我估摸着这里容不下。 可以自定义属性。
❷ android 如何清除之前item设置的属性动画
有力量感的eqvmporridge用心良苦的快j7
❸ android item上的控件怎么设置点击事件
布局文件中加入属性 android:id="@+id/content_01"
Activity中好袜凯Button button_01=(Button) findViewById(R.id.content_01);
点击友唤事件好态
button_01.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, ConversationListActivity.class);
startActivity(intent);
}
});
❹ Android listview的item点击事件怎么失效了
原因多半是由于在自己定义的Item中存在诸如ImageButton,Button,CheckBox等子控件(也可以说是Button或者Checkable的子类控件),此时这些子控件会将焦点获取到,所以常常当点击item时变化的是子控件,item本身的点击没有响应。
这时候就可以使用descendantFocusability来解决啦,API描述如下:
android:descendantFocusability
Defines the relationship between the ViewGroup and its descendants when looking for a View to take focus.
Must be one of the following constant values.
该属性是当一个为view获取焦点时,定义viewGroup和其子控件两者之间的关系。念瞎告
属性仔明的值有三种:
beforeDescendants:viewgroup会优先其子类控件而获取到焦点
afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
blocksDescendants:viewgroup会神搏覆盖子类控件而直接获得焦点
通常用到的是第三种,即在Item布局的根布局加上android:descendantFocusability=”blocksDescendants”的属性就好了
❺ 如何在android style文件中使用自定义属性
下面是一个标准的style文件的代码部分,参考下:
实际上就是把想实现部分相同效果的控件的【属性】都放到激数一个style标签里
<style name="蚂败TextViewStyle1">
<item name="android:textColor">闷铅颤@android:color/holo_red_light</item>
<item name="android:textSize">40sp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">200dp</item>
<item name="android:background">#ffff00ff</item>
<item name="android:gravity">center_horizontal</item>
</style>
❻ android studio menu怎么用
1.<item>标签的属性含义如下:
Id:表示菜单项的资源ID
menuCategory:同种菜单项的种类。该属性可取4个值:container、system、secondary和alternative。通过menuCategroy属性可以控制菜单项的位置。例如将属性设为system,表示该菜单项是系统菜单,应放在其他种类菜单项的后面。
orderInCategor:同种类菜单的排列顺序。该属性需要设置一个整数值。例如menuCategory属性值都为system的3个菜单项(item1、item2和item3)。将这3个菜单项的orderInCategory属性值设为3、2、1,那么item3会显示在最前面,而item1会显示在最后面。
title:菜单项标题(菜单项显示的文本)
titleCondensed:菜单项的短标题。当菜单项标题太长时会显示该属性值
icon:菜单项图标资源ID
alphabeticShortcut:菜单项的字母快捷键
numericShortcut:菜单项的数字快捷键
checkable:表示菜单项是否带复选框。该属性可设计为true或false
checked:如果菜单项带复选框(checkable属性为true),该属性表示复选框默认状态是否被选中。可设置的值为true或false
visible:菜单项默认状态是否可视
enable:菜单项默认状态是否被激活
2.<group>标签的属性含义如下:
id:表示菜单组的ID
menuCategory:与<item>标签的同名属性含义相同。只是作用域为菜单组
orderInCategory:与<item>标签的同名属性含义相同。只是作用域为菜单组
checkableBehavior:设置该组所有菜单项上显示的选择组件(CheckBox或Radio Button)。如果将该属性值设为all,显示CheckBox组件;如果设为single,显示Radio Button组件;如果设为none,显示正常的菜单项(不显示任何选择组件)。要注意的是,Android SDK官方文档在解释该属性时有一个笔误,原文是:
Whether the items are checkable. Valid values: none, all(exclusive/radiobuttons), single(non-exclusive/checkboxes).
相反了,正确应该是
all(non-exclusive/checkboxes),single(exclusive/radiobuttons).
visible:表示当前组中所有菜单项是否显示。该属性可设置的值是true或false
enable:表示当前组中所有菜单项是否被激活。该属性可设置的值是true或false
3.具体使用
在代码中使用
public boolenonCreateOptionsMenu(Menu menu){
MenuInflatemenuInflate = getMenuInflate();
menuInflate.inflate(R.menu.option_menu,menu);
returntrue;
}
二、使用代码定义Menu
public boolean onCreateOptionsMenu(Menu menu){
// 方法一,用代码构建
menu.add(Menu.NONE, Menu.NONE, 1, "菜单1");
menu.add(Menu.NONE, Menu.NONE, 2, "菜单2");
menu.add(Menu.NONE, Menu.NONE, 3, "菜单3");
menu.add(Menu.NONE, Menu.NONE, 4, "菜单4");
menu.add(Menu.NONE, Menu.NONE, 5, "菜单5");
menu.add(Menu.NONE, Menu.NONE, 6, "菜单6");
return true;
}
三、菜单响应
重写onOptionsItemSelected(MenuItem item)这个方法就可以做响应的操作了。
四、实例
res/menu下的activity_main.xml文件
❼ android xml资源数组的问题 ,xml文件内容如下,我要怎么获取item键值对中name这个属性的值
读取数据代码:getValue(this,"第四");
public String getValue(Context context, String strText) {
String strData = "";
DocumentBuilderFactory factory = null;
DocumentBuilder builder = null;
Document document = null;
InputStream inputStream = null;
// 首先找到xml文件
factory = DocumentBuilderFactory.newInstance();
try {
// 找到xml,并加载文档
builder = factory.newDocumentBuilder();
inputStream = context.getResources().getAssets()
.open("data.xml");
document = builder.parse(inputStream);
// 找到根Element
Element root = document.getDocumentElement();
NodeList nodes = root.getElementsByTagName("item");
// 遍历根节点所有子节点
Element cardElement;
String strName;
String strValues;
for (int i = 0; i < nodes.getLength(); i++) {
cardElement = (Element) (nodes.item(i));
strName = cardElement.getAttribute("value");
Element eValues = (Element) cardElement
.getElementsByTagName("item").item(0);
strValues = eValues.getFirstChild().getNodeValue();
if (strValues.equals(strText)) {
strData = strName;
break;
}
if (i == nodes.getLength() - 1) {
Log.v(TAG, "未查到相关信息。。。");
strData = "";
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} finally {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return strData;
}
❽ android自定义listview item间距颜色属性,
也就是2个item之间的那根线是吧,ListView自己提供了方法的,ListView.setDivider(“你要修改的颜色(最好放一张图片)”);就是这个方法,可以解决你的问题。
❾ Android RadioButton中如何去掉前面的选中的圆圈
一、定义一个style,然后设置一个item属性为@null
<style name="style">
<item name="android:button">@null</item>
</扮慎style>握缺橡
二、RadioButton引用下就OK
<RadioButton
style="@style/段旁style"
/>
❿ android的xml,这个item元素是干什么用的,比如<item>@string/c1</item>,item作用是作用是什么
item表示项,表示一项内容,仅是一个标记作用,好比ComboBox的选项一样,下拉列表一行就表示一项