select在android
1. 安卓app中的select不能用怎么弄
你想要的不是select,而是用css+div+javascript做的,就是显示和隐藏一个div,div里面是选择项,点一个,上面的小div里面显示你点的那个
2. android中的selector文件怎样创建
Android中的Selector主要是用来改变控件的背景,可以设置控件不同状态下的背景,如按下,焦点,无焦点,被选中。。。等等
创建selecetor一般放在res的drawable目录下
右击drawable目录,new一个android xml file
<?xmlversion="1.0"encoding="utf-8"?>
<selectorxmlns:android="http://schemas.android.com/apk/res/android">
<itemandroid:state_pressed="true">
<shape>
<solidandroid:color="#FF2233"/>
</shape>
</item>
<item>
<shape>
<solidandroid:color="#FF6633"/>
</shape>
</item>
</selector>
item中state的属性有如下
android:state_pressed 是否按下,如一个按钮触摸或者点击。
android:state_focused 是否取得焦点,比如用户选择了一个文本框。
android:state_hovered 光标是否悬停,通常与focused state相同,它是4.0的新特性
android:state_selected 被选中,它与focus state并不完全一样,如一个list view 被选中的时候,它里面的各个子组件可能通过方向键,被选中了。
android:state_checkable 组件是否能被check。如:RadioButton是可以被check的。
android:state_checked 被checked了,如:一个RadioButton可以被check了。
android:state_enabled 能够接受触摸或者点击事件
android:state_activated 被激活(这个麻烦举个例子,不是特明白)
android:state_window_focused 应用程序是否在前台,当有通知栏被拉下来或者一个对话框弹出的时候应用程序就不在前台了
需要注意的是如果有多个item,那么程序将自动从上到下进行匹配,最先匹配的将得到应用。所以最好把默认的放到最后面
3. android在访问html页面中有select时,点击没有反应
换个浏览器就好了.你访问的页面点击select没反应,说明编辑这个网页的程序员没有针对你的浏览器测试过.我也是程序员,编辑的网页只针对谷歌和360浏览器,其他浏览器能不能运行不管,只有大公司的网页才会尽可能多的支持不同浏览器.
4. android 按钮selector写在哪
以下是按钮的selector使用
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_pressed" android:state_pressed="true"></item>
<item android:drawable="@drawable/btn_focused" android:state_focused="true"></item>
<item android:drawable="@drawable/btn_normal"></item> </selector>
5. android 有没有像html里的select
安卓会默认把select里的内容作出一个弹出框,不会有下拉效果,不过可以自己写一个类似效果
6. android手机的select的默认样式是怎么的
select的样式,可以使用自定义的图片之类的,如下:
1、首先res/drawable中定义编写如下样式:
Java代码
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/check_true" android:state_checked="true"></item>
<item android:drawable="@drawable/check_true" android:state_selected="true"></item>
<item android:drawable="@drawable/check_true" android:state_pressed="true"></item>
<item android:drawable="@drawable/check_false"></item>
</selector>
2、在layout中添加checkbox控件:
Java代码
<CheckBox
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_check"
android:button="@null"
android:checked="true"/>
其中drwable/btn_check为1中顶一个文件名称,另外必须将android:button设置为@null。
@drawable/check_true和@drawable/check_false为checkbox不同状态的图片,可自行设计。
7. 如何让selector在android studio工作室
啥意思 直接在res 下面drawable 创建一个 xml 写selector 在布局中调用就成啦 跟ecliose 一眼的
8. android列举selector标签常用到属性,并说明分别代表哪些意思
千峰扣丁为您总结:
android:state_pressed
Boolean、“true”表示按下状态使用(例如按钮按下)、“false”表示非按下状态使用
android:state_focused
Boolean、“true”表示聚焦状态使用(例如使用滚动球/D-pad聚焦Button);“false”表示非聚焦状态使用
android:state_selected
Boolean、“true”表示选中状态使用(例如Tab
打开);“false”
表示非选中状态使用
android:state_checkable
Boolean、“true”表示可勾选状态时使用;“false”表示非可
勾选状态使用、(只对能切换可勾选—非可勾选的构件有用、)
android:state_checked
Boolean、“true”表示勾选状态使用;“false”表示非勾选状态使用
android:state_enabled
Boolean、“true”表示可用状态使用(能接收触摸/点击事件)、“false”表示不可用状态使用
android:window_focused
Boolean、“true”表示应用程序窗口有焦点时使用(应用程序在前台)、“false”表示无焦点时使用(例如Notification栏拉
下或对话框显示
9. android中selector怎么用
Android中的Selector用来改变ListView和Button控件的默认背景。
其使用方法请参照如下步骤:
一.创建xml文件,位置:drawable/xxx.xml,同目录下记得要放相关图片
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 默认时的背景图片-->
<item android:drawable="@drawable/pic1" />
<!-- 没有焦点时的背景图片 -->
<item android:state_window_focused="false"
android:drawable="@drawable/pic1" />
<!-- 非触摸模式下获得焦点并单击时的背景图片 -->
<item android:state_focused="true" android:state_pressed="true" android:drawable= "@drawable/pic2" />
<!-- 触摸模式下单击时的背景图片-->
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/pic3" />
<!--选中时的图片背景-->
<item android:state_selected="true" android:drawable="@drawable/pic4" />
<!--获得焦点时的图片背景-->
<item android:state_focused="true" android:drawable="@drawable/pic5" />
</selector>
二.使用xml文件:
1.方法一:在listview中配置android:listSelector="@drawable/xxx
或者在listview的item中添加属性android:background="@drawable/xxx"
2.方法二:Drawable drawable = getResources().getDrawable(R.drawable.xxx);
ListView.setSelector(drawable);但是这样会出现列表有时候为黑的情况,需要加上:android:cacheColorHint="@android:color/transparent"使其透明。
相关属性:
android:state_selected是选中
android:state_focused是获得焦点
android:state_pressed是点击
android:state_enabled是设置是否响应事件,指所有事件
根据这些状态同样可以设置button的selector效果。也可以设置selector改变button中的文字状态。
以下是配置button中的文字效果:
drawable/button_font.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="#FFF" />
<item android:state_focused="true" android:color="#FFF" />
<item android:state_pressed="true" android:color="#FFF" />
<item android:color="#000" />
</selector>
Button还可以实现更复杂的效果,例如渐变
drawable/button_color.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> /
<item android:state_pressed="true">//定义当button 处于pressed 状态时的形态。
<shape>
<gradient android:startColor="#8600ff" />
<stroke android:width="2dp" android:color="#000000" />
<corners android:radius="5dp" />
<padding android:left="10dp" android:top="10dp"
android:bottom="10dp" android:right="10dp"/>
</shape>
</item>
<item android:state_focused="true">//定义当button获得 focus时的形态
<shape>
<gradient android:startColor="#eac100"/>
<stroke android:width="2dp" android:color="#333333" color="#ffffff"/>
<corners android:radius="8dp" />
<padding android:left="10dp" android:top="10dp"
android:bottom="10dp" android:right="10dp"/>
</shape>
</item>
</selector>
最后,需要在包含 button的xml文件里添加两项。例如main.xml 文件,需要在<Button />里加两项android:focusable="true" android:background="@drawable/button_color"
10. <SELECT>标签的onchange事件在手机上不能用
请仔细检查你的拼写和语法。select的onchange事件手机浏览器是支持的。我曾经做过二级联动,就是要使用这个事件的。
JCitySelect.addEventListener("change",function(){
varvalue=this.options[this.options.selectedIndex].value;
_this.cityId=value;
_this.pageNo=1;
_this.pageSize=8;
_this.pageCount=0;
_this.changeCON(value);
},false);
这个页面就有select的下拉应用。上面是代码onchange部分的代码。
http://m.pcauto.com.cn/club/city/