android r.styleable是什么哪个目录

&>&android.R.styleable 类包含 XML属性
android.R.styleable 类包含 XML属性
上传大小:25KB
android.R.styleable 类包含所有组件相关的XML属性。
综合评分:4(1位用户评分)
下载个数:
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, _username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click",'.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有1条
很全啊 很好
上传者:wodetiande
上传时间:积分/C币:5
上传者:dcsff
上传时间:积分/C币:3
上传者:qq_
上传时间:积分/C币:5
上传者:dcsff
上传时间:积分/C币:3
上传者:luoai0303
上传时间:积分/C币:3
上传者:langlang55
上传时间:积分/C币:3
上传者:5iasp
上传时间:积分/C币:3
上传者:harvic880925
上传时间:积分/C币:8
上传者:serlyzxc
上传时间:积分/C币:3
上传者:luoai0303
上传时间:积分/C币:3
上传者:double2hao
上传时间:积分/C币:5
上传者:kongxiangqi
上传时间:积分/C币:3
上传时间:积分/C币:3
上传者:v587ge
上传时间:积分/C币:3
上传者:wyww1989
上传时间:积分/C币:0
上传者:yrsd90
上传时间:积分/C币:3
上传者:tang_tx_001
上传时间:积分/C币:3
上传者:luanhuanu
上传时间:积分/C币:3
上传者:xdj1234ghb
上传时间:积分/C币:3
上传者:supermapsupport
上传时间:积分/C币:2
审核通过送C币
Android学习资料,视频全集,全套完整视频
GZM技术学习分享
创建者:qq_
Android源代码
创建者:kudingcha5279
上传者其他资源上传者专辑
android 动画顺序播放源码
Android 对话框大全
Android 对话框(Dialog)大全
Android嵌入广告源码demo以及说明文档
Android入门
VIP会员动态
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
扫码关注并点击右下角获取下载码
输入下载码
为了良好体验,不建议使用迅雷下载
android.R.styleable 类包含 XML属性
会员到期时间:
剩余下载个数:
剩余C币:593
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
(仅够下载10个资源)
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可奖励5下载分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
android.R.styleable 类包含 XML属性相关文章推荐
今天尝试编译Android SDK中APIDemos中的程序,调试到HelloGallery的时候,在下面这段代码中:
[java] view
今天尝试编译Android SDK中APIDemos中的程序,调试到HelloGallery的时候,在下面这段代码中:
public ImageAdapter(Context c) {
该问题解决办法适用于任何类似问题。问题的标准异常描述为:java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v...
学习VC++时经常会遇到链接错误LNK2001,该错误非常讨厌,因为对于编程者来说,最好改的错误莫过于编译错误,而一般说来发生连接错误时,编译都已通过。产生连接错误的原因非常多,尤其LNK2001错误...
解决外部符号错误:_main,_WinMain@16,__beginthreadex -!t'my`yK
在创建MFC项目时, 不使用MFC AppWizard向导, 如果没有柚煤孟钅坎问?...
解决外部符号错误:_main,_WinMain@16,__beginthreadex -!t'my`yK
在创建MFC项目时, 不使用MFC AppWizard向导, 如果没有柚煤孟钅坎问? 就会...
出现这个错误网上也有很多现象,比如工程建立的不对,一些库的导出问题,或者某某函数没有实现等等,网上也有很多有效的解决办法。
我也遇到了这个问题:程序是一个多线程程序,Debug版本没有问题...
unresolved external symbol _main解决办法
( 21:41:15)
分类: 有用...
unresolved function or method require
翻译为:为解决的功能或方法接下来说下通用解决办法1. 确定目标 搜索 require js 属于哪个javascript框...
他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)sponsored links
android r.styleable是什么或报错
r.styleable 是自定义控件
自定义控件写好的后,需要在res-value-attrs.xml中定义,如:
1 &declare-styleable name="SlidingMenu"&
&attr name="mode"&
&enum name="left" value="0" /&
&enum name="right" value="1" /&
&attr name="viewAbove" format="reference" /&
&attr name="viewBehind" format="reference" /&
&attr name="behindOffset" format="dimension" /&
&attr name="behindWidth" format="dimension" /&
&attr name="behindScrollScale" format="float" /&
&attr name="touchModeAbove"&
&enum name="margin" value="0" /&
&enum name="fullscreen" value="1" /&
&attr name="touchModeBehind"&
&enum name="margin" value="0" /&
&enum name="fullscreen" value="1" /&
&attr name="shadowDrawable" format="reference" /&
&attr name="shadowWidth" format="dimension" /&
&attr name="fadeEnabled" format="boolean" /&
&attr name="fadeDegree" format="float" /&
&attr name="selectorEnabled" format="boolean" /&
&attr name="selectorDrawable" format="reference" /&
&/declare-styleable&
导入Android SDK中Sample下ApiDemos报错的解决办法
今天突然想看下Sample下面Google为我们提供的例子是在么写的,就选了歌例子导入,谁知导入后没错,运行的时候出先了下面的错误: [ 11:01:52 - ApiDemos] Re-installation failed due to different
Error处理: android.media.MediaRecorder.start(Native Method) 报错:start failed: -19 spydroid-android测试在android4.0系统上报错 start failed: -19 而且也发现,在使用MediaRecorder进行视频录制,调用start()方法时报错,发生sp ...
Android开发中难免要更新UI,比如做一个时钟,时间总要动吧?这时间就要更新UI,但很多时间不方便把更新UI的代码放在主线程中,就比如说做一个精确度到毫秒级的时钟,因为精度是毫秒级的,那么更新时间的频率也要是毫秒级的,不然所谓的毫秒级就没什么意义了.这样一来,就要在很短的时间就更新一次UI,如果放在主线程里做,那么主线程的大部分工作是耗在 ...
Tuesday, March 31, 2015 之前用rvest帮人写了一个定期抓取amazon价格库存,并与之前价格比较的小程序,算是近期写过的第一个完整的程序了.里面涉及了一些报错的处理. 这里主要参考了stackoverflow上的以下问答: How to skip an error in a loop skip to next value of lo ...
在Android工程项目中,我们经常需要引用第三方依赖包library,有可能遇到以下引用报错的问题: 在设置完library后重新打开显示管理错误,就是reference那里有个红叉叉,eclipse没有报错. 那么有可能是因为: 在windows系统下,你的工程项目跟要引用的library工程项目不是在同一个盘符或跟目录下. 因为如果在不同盘符,proj ...相关文章推荐
为View添加自定义XML属性Android中的各种Widget都提供了很多XML属性,我们可以利用这些XML属性在layout文件中为Widget的属性赋值。如下所示:...
CouponView 半圆锯齿背景虚线边框
情形:在popupwindow里面放入了ViewPager,出现伤处的错误。
参考了一下http://blog.csdn.net/Droid_zhlu/article/details/222...
原文:/rayray/p/3382087.html
在编写Android自定义按钮示例基础上,如果要指定字体大小产生这样的效果:
写一篇文章很辛苦啊!!!
转载请注明,联系请邮件
我学习Android都是结合源代码去学习,这样比较直观,非常清楚的看清效果,觉得很好,今天的...
地址:http://blog.csdn.net/iispring/article/details/
为View添加自定义XML属性
Android中的各种Widge...
相信每一位从事Android开发的程序员都遇到过需要自己去自定义View的需求,如果想通过xml指定一些我们自己需要的参数,就需要自己声明一个styleable,并在里面自定义一些attr属性,这个过...
该问题解决办法适用于任何类似问题。问题的标准异常描述为:java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v...
原文地址:http://blog.csdn.net/vipzjyno1/article/details/
最近在模仿今日头条,发现它的很多属性都是通过自定义控件并设定...
他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)博客分类:
一直有个问题就是,Android中是如何通过布局文件,就能实现控件效果的不同呢?比如在布局文件中,我设置了一个TextView,给它设置了textColor,它就能够改变这个TextView的文本的颜色。这是如何做到的呢?我们分3个部分来看这个问题1.attrs.xml
2.styles.xml
3.看组件的源码。
1.attrs.xml:
我们知道Android的源码中有attrs.xml这个文件,这个文件实际上定义了所有的控件的属性,就是我们在布局文件中设置的各类属性
你可以找到attrs.xml这个文件,打开它,全选,右键-&Show In-&OutLine。可以看到整个文件的解构
下面是两个截图:
我们大概可以看出里面是Android中的各种属性的声明,比如textStyle这个属性是这样定义的:
&!-- Default text typeface style. --&
&attr name="textStyle"&
&flag name="normal" value="0" /&
&flag name="bold" value="1" /&
&flag name="italic" value="2" /&
那么现在你知道,我们在写android:textStyle的时候为什么会出现normal,bold和italic这3个东西了吧,就是定义在这个地方。
再看看textColor:
&!-- Color of text (usually same as colorForeground). --&
&attr name="textColor" format="reference|color" /&
format的意思是说:这个textColor可以以两种方式设置,要么是关联一个值,要么是直接设置一个颜色的RGB值,这个不难理解,因为我们可以平时也这样做过。
也就是说我们平时在布局文件中所使用的各类控件的属性都定义在这里面,那么这个文件,除了定义这些属性外还定义了各种具体的组件,比如TextView,Button,SeekBar等所具有的各种特有的属性
比如SeekBar:
&declare-styleable name="SeekBar"&
&!-- Draws the thumb on a seekbar. --&
&attr name="thumb" format="reference" /&
&!-- An offset for the thumb that allows it to extend out of the range of the track. --&
&attr name="thumbOffset" format="dimension" /&
&/declare-styleable&
也许你会问SeekBar的background,等属性怎么没有看到?这是因为Android中几乎所有的组件都是从View中继承下来的,SeekBar自然也不例外,而background这个属性几乎每个控件都有,因此被定义到了View中,你可以在declare-styleable:View中找到它。
总结下,也就是说attrs.xml这个文件定义了布局文件中的各种属性attr:***,以及每种控件特有的属性declare-styleable:***
2.styles.xml:
刚才的attrs.xml定义的是组件的属性,现在要说的style则是针对这些属性所设置的值,一些默认的值。
这个是SeekBar的样式,我们可以看到,这里面设置了一个SeekBar的默认的样式,即为attrs.xml文件中的各种属性设置初始值
&style name="Widget.SeekBar"&
&item name="android:indeterminateOnly"&false&/item&
&item name="android:progressDrawable"&@android:drawable/progress_horizontal&/item&
&item name="android:indeterminateDrawable"&@android:drawable/progress_horizontal&/item&
&item name="android:minHeight"&20dip&/item&
&item name="android:maxHeight"&20dip&/item&
&item name="android:thumb"&@android:drawable/seek_thumb&/item&
&item name="android:thumbOffset"&8dip&/item&
&item name="android:focusable"&true&/item&
这个是Button的样式:
&style name="Widget.Button"&
&item name="android:background"&@android:drawable/btn_default&/item&
&item name="android:focusable"&true&/item&
&item name="android:clickable"&true&/item&
&item name="android:textAppearance"&?android:attr/textAppearanceSmallInverse&/item&
&item name="android:textColor"&@android:color/primary_text_light&/item&
&item name="android:gravity"&center_vertical|center_horizontal&/item&
有了属性和值,但是这些东西是如何关联到一起的呢?它们如何被android的framework层所识别呢?
3.组件的源码
我们看下TextView的源码:
public TextView(Context context) {
this(context, null);
}//这个构造器用来给用户调用,比如new TextView(this);
public TextView(Context context,
AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.textViewStyle);
public TextView(Context context,
AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);//为用户自定义的TextView设置默认的style
mText = "";
//设置画笔
mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.density = getResources().getDisplayMetrics().
mTextPaint.setCompatibilityScaling(
getResources().getCompatibilityInfo().applicationScale);
mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mHighlightPaint.setCompatibilityScaling(
getResources().getCompatibilityInfo().applicationScale);
mMovement = getDefaultMovementMethod();
mTransformation =
//attrs中包含了这个TextView控件在布局文件中定义的属性,比如android:background,android:layout_width等
//com.android.internal.R.styleable.TextView中包含了TextView中的针对attrs中的属性的默认的值
//也就是说这个地方能够将布局文件中设置的属性获取出来,保存到一个TypeArray中,为这个控件初始化各个属性
TypedArray a =
context.obtainStyledAttributes(
attrs, com.android.internal.R.styleable.TextView, defStyle, 0);
int textColorHighlight = 0;
ColorStateList textColor =
ColorStateList textColorHint =
ColorStateList textColorLink =
int textSize = 15;
int typefaceIndex = -1;
int styleIndex = -1;
* Look the appearance up without checking first if it exists because
* almost every TextView has one and it greatly simplifies the logic
* to be able to parse the appearance first and then let specific tags
* for this View override it.
TypedArray appearance =
//TextView_textAppearance不太了解为什么要这样做?难道是为了设置TextView的一些默认的属性?
int ap = a.getResourceId(com.android.internal.R.styleable.TextView_textAppearance, -1);
if (ap != -1) {
appearance = context.obtainStyledAttributes(ap,
com.android.internal.R.styleable.
TextAppearance);
if (appearance != null) {
int n = appearance.getIndexCount();
for (int i = 0; i & i++) {
int attr = appearance.getIndex(i);
switch (attr) {
case com.android.internal.R.styleable.TextAppearance_textColorHighlight:
textColorHighlight = appearance.getColor(attr, textColorHighlight);
case com.android.internal.R.styleable.TextAppearance_textColor:
textColor = appearance.getColorStateList(attr);
case com.android.internal.R.styleable.TextAppearance_textColorHint:
textColorHint = appearance.getColorStateList(attr);
case com.android.internal.R.styleable.TextAppearance_textColorLink:
textColorLink = appearance.getColorStateList(attr);
case com.android.internal.R.styleable.TextAppearance_textSize:
textSize = appearance.getDimensionPixelSize(attr, textSize);
case com.android.internal.R.styleable.TextAppearance_typeface:
typefaceIndex = appearance.getInt(attr, -1);
case com.android.internal.R.styleable.TextAppearance_textStyle:
styleIndex = appearance.getInt(attr, -1);
appearance.recycle();
//各类属性
boolean editable = getDefaultEditable();
CharSequence inputMethod =
int numeric = 0;
CharSequence digits =
boolean phone =
boolean autotext =
int autocap = -1;
int buffertype = 0;
boolean selectallonfocus =
Drawable drawableLeft = null, drawableTop = null, drawableRight = null,
drawableBottom =
int drawablePadding = 0;
int ellipsize = -1;
boolean singleLine =
int maxlength = -1;
CharSequence text = "";
CharSequence hint =
int shadowcolor = 0;
float dx = 0, dy = 0, r = 0;
boolean password =
int inputType = EditorInfo.TYPE_NULL;
int n = a.getIndexCount();
for (int i = 0; i & i++) {
int attr = a.getIndex(i);
//通过switch语句将用户设置的,以及默认的属性读取出来并初始化
switch (attr) {
case com.android.internal.R.styleable.TextView_editable:
editable = a.getBoolean(attr, editable);
case com.android.internal.R.styleable.TextView_inputMethod:
inputMethod = a.getText(attr);
case com.android.internal.R.styleable.TextView_numeric:
numeric = a.getInt(attr, numeric);
//更多的case语句...
case com.android.internal.R.styleable.TextView_textSize:
textSize = a.getDimensionPixelSize(attr, textSize);//设置当前用户所设置的字体大小
case com.android.internal.R.styleable.TextView_typeface:
typefaceIndex = a.getInt(attr, typefaceIndex);
//更多的case语句...
通过上面的代码大概可以知道,每个组件基本都有3个构造器,其中只传递一个Context上下文的那个构造器一般用来在java代码中实例化使用。
比如你可以
TextView tv = new TextView(context);
来实例化一个组件。
最终调用的是第3个构造器
public TextView(Context context,
AttributeSet attrs,
int defStyle)
在这个构造器中为你设置了默认的属性attrs和值styles。关键不在这里,而是后面通过使用下面的代码
TypedArray a =
context.obtainStyledAttributes(
attrs, com.android.internal.R.styleable.TextView, defStyle, 0);
来将属性和值获取出来,放到一个TypeArray中,然后再利用一个switch语句将里面的值取出来。再利用这些值来初始化各个属性。这个View最终利用这些属性将这个控件绘制出来。
如果你在布局文件中定义的一个View的话,那么你定义的值,会被传递给构造器中的attrs和styles。也是利用同样的方式来获取出你定义的值,并根据你定义的值来绘制你想要的控件。
再比如其实Button和EditText都是继承自TextView。看上去两个控件似乎差异很大,其实不然。Button的源码其实相比TextView变化的只是style而已:
public class Button extends TextView {
public Button(Context context) {
this(context, null);
public Button(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.buttonStyle);
public Button(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
再看看EditText:
public class EditText extends TextView {
public EditText(Context context) {
this(context, null);
public EditText(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.editTextStyle);
public EditText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
protected boolean getDefaultEditable() {
protected MovementMethod getDefaultMovementMethod() {
return ArrowKeyMovementMethod.getInstance();
public Editable getText() {
return (Editable) super.getText();
public void setText(CharSequence text, BufferType type) {
super.setText(text, BufferType.EDITABLE);
* Convenience for {@link Selection#setSelection(Spannable, int, int)}.
public void setSelection(int start, int stop) {
Selection.setSelection(getText(), start, stop);
* Convenience for {@link Selection#setSelection(Spannable, int)}.
public void setSelection(int index) {
Selection.setSelection(getText(), index);
* Convenience for {@link Selection#selectAll}.
public void selectAll() {
Selection.selectAll(getText());
* Convenience for {@link Selection#extendSelection}.
public void extendSelection(int index) {
Selection.extendSelection(getText(), index);
public void setEllipsize(TextUtils.TruncateAt ellipsis) {
if (ellipsis == TextUtils.TruncateAt.MARQUEE) {
throw new IllegalArgumentException("EditText cannot use the ellipsize mode "
+ "TextUtils.TruncateAt.MARQUEE");
super.setEllipsize(ellipsis);
不知道你是不是和我一样感到意外呢?
不得不说这种方式非常的好。最大程度地利用了继承,并且可以让控件之间的属性可以很方便的被开发者使用。也利用以后的扩展,实际上,不同的style就可以得到不同的UI,这也是MVC的一种体现。
比如用户想自定义某个控件,只要覆盖父类的style就可以很轻松的实现,可以参考我的一篇博文,就是使用style自定义。
Android中的主题theme也是使用的style。当用户在Activity中设置一个style的时候那么会影响到整个Activity,如果为Application设置style的话,则会影响所有的Activity,所以,如果你在开发一个应用的时候
可以考虑将应用的Activity的背景颜色等一类的属性放到一个style中去,在Application中调用,这种做法会比较方便。
themes.xml:
&!-- Variant of the default (dark) theme with no title bar --&
&style name="Theme.NoTitleBar"&
&item name="android:windowNoTitle"&true&/item&
&!-- Variant of the default (dark) theme that has no title bar and
fills the entire screen --&
&style name="Theme.NoTitleBar.Fullscreen"&
&item name="android:windowFullscreen"&true&/item&
&item name="android:windowContentOverlay"&@null&/item&
我们平时使用的主题实际上就定义在这个文件中。也是一个style。
浏览 22948
前辈!问一下.attrs.xml这个文件在源码的什么位置啊已解决。。
michaelye1988
浏览: 364557 次
来自: 福州
多谢楼主分享
soldier93 写道无关素质,我只发表自己的看法!既然你发 ...
无关素质,我只发表自己的看法!既然你发表了博客我就有权对其评价 ...
soldier93 写道laji 素质真低
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'

我要回帖

更多关于 android 目录是否存在 的文章

 

随机推荐