学习笔记之——Android常用属性归纳

来源:互联网 发布:c ide推荐 知乎 编辑:程序博客网 时间:2024/06/02 04:48

        本篇博客仅作为个人学习笔记所用,各种Android常用属性归纳长期更新,如有错误和建议还望指点~


1.控件透明度和半透明度:

半透明<Button Android:background="#e0000000" ... />
透明<Button android:background="#00000000" ... />
颜色和不透明度 (alpha) 值以十六进制表示法表示。任何一种颜色的值范围都是 0 到 255(00 到 ff)。对于 alpha,00 表示完全透明,ff 表示完全不透明。表达式顺序是“aabbggrr”,其中aa=alpha(00 到 ff);bb=blue(00 到 ff);gg=green(00 到 ff);rr=red(00 到 ff)。例如,如果您希望对某叠加层应用不透明度为 50% 的蓝色,则应指定以下值:7fff0000

View v = findViewById(R.id.content);//找到你要设透明背景的layout 的id 

v.getBackground().setAlpha(100);//0~255透明度值 ,0为完全透明,255为不透明

如果美工给你标注透明度多少,此时你不知道怎么变成16进制,可以参考下面的图片,希望对你们有用



2.关于TextView、EditText属性设置

EditText:

解决Andriod软键盘出现把原来的布局给顶上去的方法:http://blog.csdn.net/xww810319/article/details/17397429

通过在AndroidManifest文件中activity标签下添加android:windowSoftInputMode="adjustResize|stateHidden"属性防止标题栏向上移动消失

android:hint="请输入数字!"//设置显示在空间上的提示信息android:numeric="integer"//设置只能输入整数,如果是小数则是:decimalandroid:singleLine="true"//设置单行输入,一旦设置为true,则文字不会自动换行。android:gray="top"//多行中指针在第一行第一位置et.setSelection(et.length());//调整光标到最后一行android:autoText //自动拼写帮助android:capitalize //首字母大写android:digits //设置只接受某些数字android:singleLine //是否单行或者多行,回车是离开文本框还是文本框增加新行android:numeric //只接受数字android:password //密码android:phoneNumber // 输入电话号码android:editable //是否可编辑android:autoLink=”all” //设置文本超链接样式当点击网址时,跳向该网址android:password="true"//设置只能输入密码android:textColor ="#ff8c00"//字体颜色android:textStyle="bold"//字体,bold,italic, bolditalicandroid:textSize="20dip"//大小android:capitalize ="characters"//以大写字母写android:textAlign="center"//EditText没有这个属性,但TextView有android:textColorHighlight="#cccccc"//被选中文字的底色,默认为蓝色android:textColorHint="#ffff00"//设置提示信息文字的颜色,默认为灰色android:textScaleX="1.5"//控制字与字之间的间距android:typeface="monospace"//字型,normal,sans, serif, monospaceandroid:background="@null"//空间背景,这里没有,指透明android:layout_weight="1"//权重在控制控  件显示的大小时蛮有用的。android:textAppearance="?android:attr/textAppearanceLargeInverse"//文字外观,这里引用的是系统自带的一个外观,?表示系统是否有这种外观,否则使用默认的外观。

(1)Android系统中TextView默认行间距比较窄,不美观。

    我们可以设置每行的行间距,可以通过属性android:lineSpacingExtra或android:lineSpacingMultiplier来做。

    在你要设置的TextView中加入如下代码:

       (1)android:lineSpacingExtra 设置行间距,如”8dp”。

       (2)android:lineSpacingMultiplier 设置行间距的倍数,如”1.5″。

(2) TextView在代码中如果要修改drawableRight设置的图片可以使            setCompoundDrawables(Drawable left,Drawable top,Drawable right,Drawable bottom)

          Drawable可以通过 Drawable nav_up=getResources().getDrawable(R.drawable.button_nav_up);得到

         但是API提示,setCompoundDrawables() 调用的时候,Drawable对象必须调用setBounds(int left, int top, int right, int bottom)方法,于是我们          加一行代码就可以了

[java] view plain copy
  1. nav_up.setBounds(00, nav_up.getMinimumWidth(), nav_up.getMinimumHeight());  
代码合在一起是这样的:
[java] view plain copy
  1. Drawable nav_up=getResources().getDrawable(R.drawable.button_nav_up);  
  2. nav_up.setBounds(00, nav_up.getMinimumWidth(), nav_up.getMinimumHeight());  
  3. textview1.setCompoundDrawables(nullnull, nav_up, null);  

(3) 通过textColorHint设置edittext提示信息的颜色    

3.关于ListView属性设置

   (1)设置ListView分割线:dividerHight / divider

   (2)设置ListView不要右边指示线:android:scrollbars="none"

    (3)android listview 取消头部分割线

              

          listview分割线会在头部、数据item、及根部的底部打印,如果要取消头部分割线必须

            先设置期方法

            addHeaderView(headView, null, true);
            addFooterView(footView, null, true);

            注意:第三个参数必须为true,否则无效

            //显示头部出现分割线

            listview.setHeaderDividersEnabled(true);
            //禁止底部出现分割线 
             listview.setFooterDividersEnabled(false);

            Android:headerDividersEnabled="true"

            android:footerDividersEnabled="false"

    (4)任意加头去头,加脚去脚。

我们知道ListView在setAdapter之后再调用addHeader方法会抛出异常,而加脚有时管用,有时不管用。Android开发文档中也明确指出ListView在setAdapter之后不应该再进行setHeader和setFooter方法。这明显不能满足我们的实际需求。

我的解决方案是:在setAdapter之前给ListView先加上一个空头布局和空脚布局,布局高度设为wrap_content,这样当头或脚布局中没有任何组件时,头和脚是看不到的。当需要显示头和脚时,直接向头和脚布局中添加要显示的组件即可。即设置      组件.setVisibility(View.VISIBLE);或者组件.setVisibility(View.GONE);即可

(5)listview滑动监听。

      //listview滑动监听mainListView.setOnScrollListener(new OnScrollListener() {@Overridepublic void onScrollStateChanged(AbsListView view, int scrollState) {switch (scrollState) {              case OnScrollListener.SCROLL_STATE_IDLE: //停止                break;              case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL://正在滑动                break;              case OnScrollListener.SCROLL_STATE_FLING://开始滚动                  break;              }  }@Overridepublic void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {}});

      (4)去掉expandablelistview左边的图标

 在xml文件里面写死

        <ExpandableListView
            Android:id="@+id/myExpandableListView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#ffffff"          
    android:groupIndicator="@null"   //去掉图标
            android:cacheColorHint="#00000000"  //解决点击或者下来背景变黑的问题
            android:listSelector="#00000000" >
        </ExpandableListView>  

 在程序里面动态改变

ExpandableListView expandListView = (ExpandableListView) findViewById(R.id.list); 

//设置 属性 GroupIndicator 去掉默认向下的箭头  

expandListView.setGroupIndicator(null); 

ExpandableListView去掉里头的分割线

代码:

expandableList.setDivider(null);


xml:

Android:divider="@null"


或者
设置driverHeight="0dip"或者driver="透明的图片",这是设置第一级菜单的分割线的,二级菜单ChildDriver="0dip"



4.关于其他功能属性设置

     (1)xml中引入一个布局:

      <include         android:id="@+id/layout_float"        layout="@layout/layout_usercenter_floathead"        android:layout_width="match_parent"        android:layout_height="<span style="font-family: Arial, Helvetica, sans-serif;">match_parent</span><span style="font-family: Arial, Helvetica, sans-serif;">"</span>/>

      (2)drawable属性:

              ①设置控件选中时和默认时的图片变化

<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_shortAnimTime">    <item android:state_pressed="true" android:drawable="@color/background_tab_pressed" />    <item android:state_focused="true" android:drawable="@color/background_tab_pressed"/>    <item android:drawable="@android:color/transparent"/></selector>
            ②设置checkbox或者radiobutton等有点击状态的控件,点击时图片和默认图片的颜色改变
<selector xmlns:android="http://schemas.android.com/apk/res/android">    <item android:state_checked="true" android:drawable="@drawable/corner_s"></item>    <item android:state_checked="false" android:drawable="@drawable/corner_n"></item></selector>
           ③设置字体点击时和默认时候的颜色改变

<selector xmlns:android="http://schemas.android.com/apk/res/android" >    <item android:state_checked="true" android:color="#af0000"/>      <item android:state_checked="false" android:color="#333333"/></selector>
          ④设置角度、边框颜色和边框等属性

<shape xmlns:android="http://schemas.android.com/apk/res/android" >    <corners  android:radius="20dp"/>    <solid android:color="#ffffff"/>    <stroke android:width="0.5dip" android:color="@color/color_d9" /></shape>
 设置虚线:
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:shape="line" >  
  4.     <stroke  
  5.         android:dashGap="3dp"  
  6.         android:dashWidth="6dp"  
  7.         android:width="1dp"  
  8.         android:color="#63a219" />  
  9.     <!-- 虚线的高度 -->  
  10.     <size android:height="1dp" />  
  11. </shape>  
其中,破折线的宽度为dashWith,破折线之间的空隙的宽度为dashGap,当dashGap=0dp时,为实线

设置圆角:
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android"   
  3.     android:shape="rectangle">  
  4.     <!-- 填充颜色 -->  
  5.     <solid android:color="#FFFFFF"></solid>  
  6.     <!-- 线的宽度,颜色灰色 -->  
  7.     <stroke android:width="1dp" android:color="#63a219"></stroke>          
  8.     <!-- 矩形的圆角半径 -->  
  9.     <corners android:radius="10dp" />         
  10. </shape>  
设置渐变填充和四个圆角半径:
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <shape xmlns:android="http://schemas.android.com/apk/res/android"   
  2.     android:shape="rectangle">  
  3.     <!--分別對應上面左圆角的半径,上面右圆角的半径,下面左圆角的半径,下面右圆角的半径-->  
  4.     <corners    
  5.           android:topLeftRadius="0dp"  
  6.           android:topRightRadius="7dp"  
  7.           android:bottomLeftRadius="0dp"  
  8.           android:bottomRightRadius="7dp"/>  
  9.     <!--設置漸變-->  
  10.     <gradient android:startColor="#9cff00"   
  11.           android:endColor="#197600"  
  12.           android:angle="270"/>  
  13.     <stroke     
  14.         android:width="1dp"   
  15.         android:color="#63a219" />   
  16. </shape>  
设置渐变点击效果:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <style name="list_item_top">  
  2.     <item name="android:clickable">true</item>  
  3.     <item name="android:focusable">true</item>  
  4.     <item name="android:paddingTop">10dip</item>  
  5.     <item name="android:paddingBottom">10dip</item>  
  6.     <item name="android:paddingLeft">10dip</item>  
  7.         <item name="android:paddingRight">10dip</item>  
  8.         <item name="android:gravity">center_vertical</item>  
  9.         <item name="android:background">@drawable/background_view_rounded_top</item>  
  10. </style>  
[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <inset xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:insetLeft="1.0px"  
  4.     android:insetRight="1.0px" >  
  5.   
  6.     <selector>  
  7.         <item android:state_pressed="true">  
  8.             <shape>  
  9.                 <gradient  
  10.                     android:angle="270.0"  
  11.                     android:endColor="@color/base_end_color_pressed"  
  12.                     android:startColor="@color/base_start_color_pressed" />  
  13.   
  14.                 <corners  
  15.                     android:bottomLeftRadius="0.0dip"  
  16.                     android:bottomRightRadius="0.0dip"  
  17.                     android:radius="2.0dip"  
  18.                     android:topLeftRadius="10.0dip"  
  19.                     android:topRightRadius="10.0dip" />  
  20.                   
  21.                 <stroke   
  22.                     android:width="1dp"   
  23.                     android:color="#eededede" />  
  24.             </shape>  
  25.         </item>  
  26.         <item>  
  27.             <shape>  
  28.                 <gradient  
  29.                     android:angle="270.0"  
  30.                     android:endColor="@color/base_end_color_default"  
  31.                     android:startColor="@color/base_start_color_default" />  
  32.   
  33.                 <corners  
  34.                     android:bottomLeftRadius="0.0dip"  
  35.                     android:bottomRightRadius="0.0dip"  
  36.                     android:radius="2.0dip"  
  37.                     android:topLeftRadius="11.0dip"  
  38.                     android:topRightRadius="11.0dip" />  
  39.                   
  40.                 <stroke   
  41.                     android:width="1dp"   
  42.                     android:color="#eededede" />  
  43.             </shape>  
  44.         </item>  
  45.     </selector>  
  46.   
  47. </inset>  


5.Android布局自定义Shap圆形ImageView,可以单独设置背景与图片

一、图片预览:

一、实现功能:

需求要实现布局中为圆形图片,图片背景与图标分开且合并到一个ImageView。

二、具体实现:

XML中布局中定义ImageView,关健设置两个参数  Android:backgroup(设置背景),Android:src(设置ImageVIew中图片),圆形图片制作Drawable下定义xml shap样式(solid-color,size-width\hight)

XML代码如下:

<ImageView  android:id="@+id/zhongjie"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:background="@drawable/popwindow_zhongjie"  android:scaleType="centerInside"  android:src="@drawable/mark_caller_house_agent" />

Drawable-样式xml如下:

<?xml version="1.0" encoding="utf-8"?><shape  xmlns:android="http://schemas.android.com/apk/res/android"  android:shape="oval"  android:useLevel="false">  <solid android:color="#66CC00"/>  <size android:width="50dp"      android:height="50dp"/></shape>


6.android获取设备屏幕大小的方法

                // 获取屏幕的默认分辨率Display display = getWindowManager().getDefaultDisplay();tv1.setText(display.getWidth() + "");tv2.setText(display.getHeight() + "");// 通过WindowManager获取屏幕的大小DisplayMetrics dm = new DisplayMetrics();getWindowManager().getDefaultDisplay().getMetrics(dm);tv3.setText("width : " + dm.widthPixels);tv4.setText("heigth : " + dm.heightPixels);// 通过Resources获取获取屏幕的大小DisplayMetrics dm2 = getResources().getDisplayMetrics();tv5.setText("width2 : " + dm2.widthPixels);tv6.setText("heigth2 : " + dm2.heightPixels);


7.ImageView描边

drawable属性:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"    android:shape="oval"  android:useLevel="false" >  <solid android:color="@color/color_bg_eee"/>  <size android:width="27dp"      android:height="27dp"/></shape>

xml:

<ImageView            android:id="@+id/img_shuju_country"            android:layout_width="27dp"            android:layout_height="27dp"            android:padding="1px"            android:background="@drawable/shape_calendar_fragment_coutry_bg"            android:scaleType="centerInside"            android:src="@drawable/usa"            android:layout_marginTop="7dp"            android:layout_gravity="center_horizontal" />

8.ScrollView

1.scrollview 自动定位到顶部
利用获取焦点的方式定位到最顶部的组件或layout

rl_layout = (RelativeLayout) rootView.findViewById(R.id.rl_layout);
rl_layout.setFocusable(true);
rl_layout.setFocusableInTouchMode(true);
rl_layout.requestFocus();


9.几个经常用到的字符串的截取

string str="123abc456";
int i=3;
1 取字符串的前i个字符
   str=str.Substring(0,i); // or  str=str.Remove(i,str.Length-i); 
2 去掉字符串的前i个字符:
   str=str.Remove(0,i);  // or str=str.Substring(i); 
3 从右边开始取i个字符:
  str=str.Substring(str.Length-i); // or str=str.Remove(0,str.Length-i);
4 从右边开始去掉i个字符:
   str=str.Substring(0,str.Length-i); // or str=str.Remove(str.Length-i,i);
5 判断字符串中是否有"abc" 有则去掉之
   using System.Text.RegularExpressions;
   string str = "123abc456";
   string a="abc";
   Regex r = new  Regex(a); 
   Match m = r.Match(str); 
   if (m.Success)
   {
    //绿色部分与紫色部分取一种即可。
      str=str.Replace(a,"");
      Response.Write(str);   
      string str1,str2;
      str1=str.Substring(0,m.Index);
      str2=str.Substring(m.Index+a.Length,str.Length-a.Length-m.Index);

      Response.Write(str1+str2); 
   }

6 如果字符串中有"abc"则替换成"ABC"
   str=str.Replace("abc","ABC");

7.截取字符串

String str="asadsf shjasdhx";

        String[] split = str.split(" ");

8.获取字符串资源
this.getResources().getString(R.string.setIP)

1、使用subString的方法去删除

  1. private static void method02() {  
  2.         String[] str = { "3""4""5" };    
  3.         StringBuilder sb = new StringBuilder();  
  4.         if (str != null && str.length > 0) {  
  5.   
  6.             for (String s : str) {  
  7.                 sb.append(s + ",");  //循环遍历数组中元素,添加到 StringBuilder 对象中  
  8.             }  
  9.         }  
  10.         if (sb.length() > 0)  
  11.             sb.deleteCharAt(sb.length() - 1); //调用 字符串的deleteCharAt() 方法,删除最后一个多余的逗号  
  12.         System.out.println(sb.toString());  
  13.   
  14.   
  15.     }  

2、使用substring截取字符串

for (int t = 0; t < memberLen; t++) {
      memTemp =  stafferMap.get(strMember[t]);
      if(memTemp != null){
       memberNames += memTemp + ",";
      }
     }

以上的代码,拼接的字符串会多一个“,”,比如:"str1,str2,str3,",要去除str3后的逗号,可用如下方法:
     
     memberNames = memberNames.substring(0,memberNames.length()-1);

 

比如当Team1=test   ', 'U1-Team   ', 'V-Team   ', '时 

如何改成: 

Team1= 'test   ', 'U1-Team   ', 'V-Team   '

可用:

Team1   =   " ' "   +   Team1.Substring(0,   Team1.Length   -   2);


2、

  1. private static void method02() {  
  2.         String[] str = { "3""4""5" };    
  3.         StringBuilder sb = new StringBuilder();  
  4.         if (str != null && str.length > 0) {  
  5.   
  6.             for (String s : str) {  
  7.                 sb.append(s + ",");  //循环遍历数组中元素,添加到 StringBuilder 对象中  
  8.             }  
  9.         }  
  10.         if (sb.length() > 0)  
  11.             sb.deleteCharAt(sb.length() - 1); //调用 字符串的deleteCharAt() 方法,删除最后一个多余的逗号  
  12.         System.out.println(sb.toString());  
  13.   
  14.   
  15.     }  
9.截取某个字符串之前的数据
String string = mobile.substring(0, mobile.lastIndexOf("_"));

9.解决ScrollView会自动滑动到非顶部bug

img_comments_ad = (ImageView) findViewById(R.id.img_comments_ad);//位于ScrollView最顶部的控件
//解决ScrollView会自动滑动到非顶部bug
img_comments_ad.setFocusable(true);
img_comments_ad.setFocusableInTouchMode(true);
img_comments_ad.requestFocus();

10.判断网络是否连接

public class ConnectionUtils {public static boolean isWIFI(Context context){if (isConnected(context)){ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);NetworkInfo info = cm.getActiveNetworkInfo();int type = info.getType();if (ConnectivityManager.TYPE_WIFI == type){return true; }}return false;}public static boolean isMobile(Context context){if (isConnected(context)){ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);NetworkInfo info = cm.getActiveNetworkInfo();int type = info.getType();if (ConnectivityManager.TYPE_MOBILE == type){return true; }}return false;}public static boolean isConnected(Context context){ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);NetworkInfo info = cm.getActiveNetworkInfo();if (info == null){return false;}boolean available = info.isAvailable();return available;}}
使用:
if (!ConnectionUtils.isConnected(getContext())){   //网络无连接状态}else{//网络连接状态}

11.获取当前时间

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");       Date curDate = new Date(System.currentTimeMillis());//获取当前时间       String currenTime = format.format(curDate);
clickDay = Integer.parseInt(currenTime.split("-")[2]);//String转成int当前日期
Calendar c = Calendar.getInstance();String mWeek = String.valueOf(c.get(Calendar.DAY_OF_WEEK));//获取周
if ("1".equals(mWeek)) {            mWeek = "日";        } else if ("2".equals(mWeek)) {            mWeek = "一";        } else if ("3".equals(mWeek)) {            mWeek = "二";        } else if ("4".equals(mWeek)) {            mWeek = "三";        } else if ("5".equals(mWeek)) {            mWeek = "四";        } else if ("6".equals(mWeek)) {            mWeek = "五";        } else if ("7".equals(mWeek)) {            mWeek = "六";        }

12.动态添加布局、动态设置relativelayout布局高度

LinearLayout ll = (LinearLayout) findViewById(R.id.ll);LayoutInflater inflater = getLayoutInflater();View child = inflater.inflate(R.layout.layout_add, null);ll.addView(child);
Demo下载:http://download.csdn.net/detail/lxlyhm/9712684

设置RelativeLayout布局高度:
RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams)rl_downup_all.getLayoutParams();        linearParams.height = 800;        rl_downup_all.setLayoutParams(linearParams);

2、动态的获取和设置ImageView的宽度和高度

LayoutParams para;          para = image.getLayoutParams();                    Log.d(TAG, "layout height0: " + para.height);          Log.d(TAG, "layout width0: " + para.width);                    para.height = 300;          para.width = 300;          image.setLayoutParams(para);                    Log.d(TAG, "layout height: " + para.height);          Log.d(TAG, "layout width: " + para.width);

13.代码调用value色值

tv_header_title.setTextColor(getResources().getColor(R.color.common_bg_color));

附.色值
<color name="white">#ffffff</color><!--白色 -->  <color name="ivory">#fffff0</color><!--象牙色 -->  <color name="lightyellow">#ffffe0</color><!--亮黄色 -->  <color name="yellow">#ffff00</color><!--黄色 -->  <color name="snow">#fffafa</color><!--雪白色 -->  <color name="floralwhite">#fffaf0</color><!--花白色 -->  <color name="lemonchiffon">#fffacd</color><!--柠檬绸色 -->  <color name="cornsilk">#fff8dc</color><!--米绸色 -->  <color name="seaShell">#fff5ee</color><!--海贝色 -->  <color name="lavenderblush">#fff0f5</color><!--淡紫红 -->  <color name="papayawhip">#ffefd5</color><!--番木色 -->  <color name="blanchedalmond">#ffebcd</color><!--白杏色 -->  <color name="mistyrose">#ffe4e1</color><!--浅玫瑰色 -->  <color name="bisque">#ffe4c4</color><!--桔黄色 -->  <color name="moccasin">#ffe4b5</color><!--鹿皮色 -->  <color name="navajowhite">#ffdead</color><!--纳瓦白 -->  <color name="peachpuff">#ffdab9</color><!--桃色 -->  <color name="gold">#ffd700</color><!--金色 -->  <color name="pink">#ffc0cb</color><!--粉红色 -->  <color name="lightpink">#ffb6c1</color><!--亮粉红色 -->  <color name="orange">#ffa500</color><!--橙色 -->  <color name="lightsalmon">#ffa07a</color><!--亮肉色 -->  <color name="darkorange">#ff8c00</color><!--暗桔黄色 -->  <color name="coral">#ff7f50</color><!--珊瑚色 -->  <color name="hotpink">#ff69b4</color><!--热粉红色 -->  <color name="tomato">#ff6347</color><!--西红柿色 -->  <color name="orangered">#ff4500</color><!--红橙色 -->  <color name="deeppink">#ff1493</color><!--深粉红色 -->  <color name="fuchsia">#ff00ff</color><!--紫红色 -->  <color name="magenta">#ff00ff</color><!--红紫色 -->  <color name="red">#ff0000</color><!--红色 -->  <color name="oldlace">#fdf5e6</color><!--老花色 -->  <color name="lightgoldenrodyellow">#fafad2</color><!--亮金黄色 -->  <color name="linen">#faf0e6</color><!--亚麻色 -->  <color name="antiquewhite">#faebd7</color><!--古董白 -->  <color name="salmon">#fa8072</color><!--鲜肉色 -->  <color name="ghostwhite">#f8f8ff</color><!--幽灵白 -->  <color name="mintcream">#f5fffa</color><!--薄荷色 -->  <color name="whitesmoke">#f5f5f5</color><!--烟白色 -->  <color name="beige">#f5f5dc</color><!--米色 -->  <color name="wheat">#f5deb3</color><!--浅黄色 -->  <color name="sandybrown">#f4a460</color><!--沙褐色 -->  <color name="azure">#f0ffff</color><!--天蓝色 -->  <color name="honeydew">#f0fff0</color><!--蜜色 -->  <color name="aliceblue">#f0f8ff</color><!--艾利斯兰 -->  <color name="khaki">#f0e68c</color><!--黄褐色 -->  <color name="lightcoral">#f08080</color><!--亮珊瑚色 -->  <color name="palegoldenrod">#eee8aa</color><!--苍麒麟色 -->  <color name="violet">#ee82ee</color><!--紫罗兰色 -->  <color name="darksalmon">#e9967a</color><!--暗肉色 -->  <color name="lavender">#e6e6fa</color><!--淡紫色 -->  <color name="lightcyan">#e0ffff</color><!--亮青色 -->  <color name="burlywood">#deb887</color><!--实木色 -->  <color name="plum">#dda0dd</color><!--洋李色 -->  <color name="gainsboro">#dcdcdc</color><!--淡灰色 -->  <color name="crimson">#dc143c</color><!--暗深红色 -->  <color name="palevioletred">#db7093</color><!--苍紫罗兰色 -->  <color name="goldenrod">#daa520</color><!--金麒麟色 -->  <color name="orchid">#da70d6</color><!--淡紫色 -->  <color name="thistle">#d8bfd8</color><!--蓟色 -->  <color name="lightgray">#d3d3d3</color><!--亮灰色 -->  <color name="lightgrey">#d3d3d3</color><!--亮灰色 -->  <color name="tan">#d2b48c</color><!--茶色 -->  <color name="chocolate">#d2691e</color><!--巧可力色 -->  <color name="peru">#cd853f</color><!--秘鲁色 -->  <color name="indianred">#cd5c5c</color><!--印第安红 -->  <color name="mediumvioletred">#c71585</color><!--中紫罗兰色 -->  <color name="silver">#c0c0c0</color><!--银色 -->  <color name="darkkhaki">#bdb76b</color><!--暗黄褐色 -->  <color name="rosybrown">#bc8f8f</color><!--褐玫瑰红 -->  <color name="mediumorchid">#ba55d3</color><!--中粉紫色 -->  <color name="darkgoldenrod">#b8860b</color><!--暗金黄色 -->  <color name="firebrick">#b22222</color><!--火砖色 -->  <color name="powderblue">#b0e0e6</color><!--粉蓝色 -->  <color name="lightsteelblue">#b0c4de</color><!--亮钢兰色 -->  <color name="paleturquoise">#afeeee</color><!--苍宝石绿 -->  <color name="greenyellow">#adff2f</color><!--黄绿色 -->  <color name="lightblue">#add8e6</color><!--亮蓝色 -->  <color name="darkgray">#a9a9a9</color><!--暗灰色 -->  <color name="darkgrey">#a9a9a9</color><!--暗灰色 -->  <color name="brown">#a52a2a</color><!--褐色 -->  <color name="sienna">#a0522d</color><!--赭色 -->  <color name="darkorchid">#9932cc</color><!--暗紫色 -->  <color name="palegreen">#98fb98</color><!--苍绿色 -->  <color name="darkviolet">#9400d3</color><!--暗紫罗兰色 -->  <color name="mediumpurple">#9370db</color><!--中紫色 -->  <color name="lightgreen">#90ee90</color><!--亮绿色 -->  <color name="darkseagreen">#8fbc8f</color><!--暗海兰色 -->  <color name="saddlebrown">#8b4513</color><!--重褐色 -->  <color name="darkmagenta">#8b008b</color><!--暗洋红 -->  <color name="darkred">#8b0000</color><!--暗红色 -->  <color name="blueviolet">#8a2be2</color><!--紫罗兰蓝色 -->  <color name="lightskyblue">#87cefa</color><!--亮天蓝色 -->  <color name="skyblue">#87ceeb</color><!--天蓝色 -->  <color name="gray">#808080</color><!--灰色 -->  <color name="grey">#808080</color><!--灰色 -->  <color name="olive">#808000</color><!--橄榄色 -->  <color name="purple">#800080</color><!--紫色 -->  <color name="maroon">#800000</color><!--粟色 -->  <color name="aquamarine">#7fffd4</color><!--碧绿色 -->  <color name="chartreuse">#7fff00</color><!--黄绿色 -->  <color name="lawngreen">#7cfc00</color><!--草绿色 -->  <color name="mediumslateblue">#7b68ee</color><!--中暗蓝色 -->  <color name="lightslategray">#778899</color><!--亮蓝灰 -->  <color name="lightslategrey">#778899</color><!--亮蓝灰 -->  <color name="slategray">#708090</color><!--灰石色 -->  <color name="slategrey">#708090</color><!--灰石色 -->  <color name="olivedrab">#6b8e23</color><!--深绿褐色 -->  <color name="slateblue">#6a5acd</color><!--石蓝色 -->  <color name="dimgray">#696969</color><!--暗灰色 -->  <color name="dimgrey">#696969</color><!--暗灰色 -->  <color name="mediumaquamarine">#66cdaa</color><!--中绿色 -->  <color name="cornflowerblue">#6495ed</color><!--菊兰色 -->  <color name="cadetblue">#5f9ea0</color><!--军兰色 -->  <color name="darkolivegreen">#556b2f</color><!--暗橄榄绿 -->  <color name="indigo">#4b0082</color><!--靛青色 -->  <color name="mediumturquoise">#48d1cc</color><!--中绿宝石 -->  <color name="darkslateblue">#483d8b</color><!--暗灰蓝色 -->  <color name="steelblue">#4682b4</color><!--钢兰色 -->  <color name="royalblue">#4169e1</color><!--皇家蓝 -->  <color name="turquoise">#40e0d0</color><!--青绿色 -->  <color name="mediumseagreen">#3cb371</color><!--中海蓝 -->  <color name="limegreen">#32cd32</color><!--橙绿色 -->  <color name="darkslategray">#2f4f4f</color><!--暗瓦灰色 -->  <color name="darkslategrey">#2f4f4f</color><!--暗瓦灰色 -->  <color name="seagreen">#2e8b57</color><!--海绿色 -->  <color name="forestgreen">#228b22</color><!--森林绿 -->  <color name="lightseagreen">#20b2aa</color><!--亮海蓝色 -->  <color name="dodgerblue">#1e90ff</color><!--闪兰色 -->  <color name="midnightblue">#191970</color><!--中灰兰色 -->  <color name="aqua">#00ffff</color><!--浅绿色 -->  <color name="cyan">#00ffff</color><!--青色 -->  <color name="springgreen">#00ff7f</color><!--春绿色 -->  <color name="lime">#00ff00</color><!--酸橙色 -->  <color name="mediumspringgreen">#00fa9a</color><!--中春绿色 -->  <color name="darkturquoise">#00ced1</color><!--暗宝石绿 -->  <color name="deepskyblue">#00bfff</color><!--深天蓝色 -->  <color name="darkcyan">#008b8b</color><!--暗青色 -->  <color name="teal">#008080</color><!--水鸭色 -->  <color name="green">#008000</color><!--绿色 -->  <color name="darkgreen">#006400</color><!--暗绿色 -->  <color name="blue">#0000ff</color><!--蓝色 -->  <color name="mediumblue">#0000cd</color><!--中兰色 -->  <color name="darkblue">#00008b</color><!--暗蓝色 -->  <color name="navy">#000080</color><!--海军色 -->  <color name="black">#000000</color><!--黑色 -->  <color name="transparent">#0000</color><!-- 透明 --> <color name="transparent2">#8000</color><!-- 透明 -->

软键盘顶住:xml清单配置这句话即可
android:windowSoftInputMode="adjustPan|stateHidden"


感谢以下博客:http://blog.csdn.net/qiaoning13256/article/details/6910570

                 http://blog.csdn.net/lan410812571/article/details/9946991

                 http://blog.csdn.net/jake9602/article/details/13768525

                 http://www.tuicool.com/articles/FB7NryV

                 http://blog.csdn.net/as425017946/article/details/49175635

1 0
原创粉丝点击