重要文件

http://www.csdn.net/article/2013-05-06/2815145-Android-open-source-projects-two    CSDN首页> 移动开发 直接拿来用!最火的Android开源项目(二)


http://gkk.xsteach.com/course/view?gid=6#curid2   ai


http://code.cocoachina.com/index/1/30/1   苹果demo网站


http://wikidroid.sinaapp.com/Activity   activity 


sp_investment_period.setSelected(true);
((TextView)findViewById(R.id.tv_investment_period))
.setTextColor(getResources().getColor(v.isSelected()?R.color.btn_no_register:R.color.aaaaaa));






http://blog.csdn.net/mad1989/article/details/25069821   Android  如何点击编辑框之外的地方  让键盘消失


阿里巴巴一淘使用的图片加载
https://github.com/etao-open-source/cube-sdk






http://android.662p.com/thread-5812-1-1.html  小数点后面的位数,只要大于两位就立马删掉 android:inputType="numberDecimal"


http://www.csdn123.com/html/topnews201408/96/9196.htm


http://old.uimaker.com/uimakerdown/mobile/   ui
www.ui.cn    ui
http://www.ui.cn/detail/35783.html   色板


((TextView)findViewById(R.id.tv_name)).setTextColor(getResources().getColor(R.color.btn_no_register)); 
setTextColor(this.getResources().getColor(R.color.blue));//通过获得资源文件进行设置。根据不同的情况R.color.blue也可以是R.string.blue或者




mShare.setImageResource(R.drawable.ic_action_others);
http://www.gongkung.com/utf8-classid105-id121519.html    随机生成颜色
Random myRandom=new Random();
int ranColor = 0xff000000 | mRandom.nextInt(0x00ffffff);
// 随机颜色  
Random random = new Random();   
int []ranColor ={0xff000000,0x00ff00ff,0xff000000,0x00ffff00,0x00ffffff,0x00ff0000}; //0xff000000 | random.nextInt(0x00ffffff);
for(int i=0;i<ranColor.length;i++){
holder.iv_dynamic_pic.setBackgroundColor(ranColor[i]);
}






// 随机颜色  
Random random = new Random();   
int []ranColor ={0x00FFFFCC,0xCCFFFF,0xff000000,0x00ffff00,0x00FFFFCC,0x00ff0000}; //0xff000000 | random.nextInt(0x00ffffff);
int randomcolor =random.nextInt(ranColor.length);
int color = Color.argb(1, random.nextInt(255) / 255, random.nextInt(255) / 255, random.nextInt(255) / 255);
holder.iv_dynamic_pic.setBackgroundColor(color);


/**  
     * 获取十六进制的颜色代码.例如  "#6E36B4" , For HTML ,  
     * @return String  
     */  
public static String getRandColorCode(){   
  String r,g,b;   
  Random random = new Random();   
  r = Integer.toHexString(random.nextInt(256)).toUpperCase();   
  g = Integer.toHexString(random.nextInt(256)).toUpperCase();   
  b = Integer.toHexString(random.nextInt(256)).toUpperCase();   
     
  r = r.length()==1 ? "0" + r : r ;   
  g = g.length()==1 ? "0" + g : g ;   
  b = b.length()==1 ? "0" + b : b ;   
     
  return r+g+b;   
}






// 随机颜色  
Random random = new Random();   
int ranColor = 0xff000000 | random.nextInt(0x00ffffff);
holder.iv_dynamic_pic.setBackgroundColor(ranColor);








http://blog.csdn.net/lovexjyong/article/details/6854344
http://www.haodaima.net/art/2332183   listview顶部停留   ui处理
http://download.csdn.net/detail/tjx0900968/4381548  回到顶部页面上下弹动效果




http://www.csdn.net/article/2013-05-03/2815127-Android-open-source-projects      直接拿来用!最火的Android开源项目(一)


http://blog.csdn.net/h3c4lenovo/article/details/9069607
https://github.com/Trinea/android-open-project
http://blog.csdn.net/oyangyujun/article/details/43340893    Github开源Android资源整理(十)安全,插件化,文件,其他
http://wugengxin.cn/


     <requestFocus />  获得焦点




http://www.open-open.com/lib/view/open1414051610965.html  android L
http://www.wasu.cn/Play/show/id/5685434   ps
android:background="#11000000"   透明的颜色


D:\Documents\Tencent Files\350650271\FileRecv


UniversalImageLoader  图片架子


关于图片加载非常爽的一个三方控件 fresco,一个三fresco
https://github.com/facebook/fresco 这个是fresco的一个官方gifhub 官网为http://frescolib.org/


来玩一下fresco 我们去看官方向导 


http://frescolib.org/docs/index.html


1 注册你的清单文件 加一个访问网络的权限 


http://frescolib.org/docs/index.html 这个没什么好说的 加一个就行了




Google Protocol Buffer 的使用和原理




http://119.254.101.12:8001/test   测试接口




http://www.bilibili.com/html/join.html#j10  招聘
http://gkk.xsteach.com/course/view?gid=6#curid2   ai






// /** 处理注册/更新返回结果 */
private void postRegister() {
Intent intent = new Intent(this, HomeActivity.class);
intent.putExtra("tabIndex", 1);
startActivity(intent);
}


/** 初始化属性 */
private void initData() {
Intent data = getIntent();
if (data != null) {
mTabIndex = data.getIntExtra("tabIndex", 0);
}
setTabSelection(mTabIndex);
}








return list == null ? null : list.get(position);
@Override
public Contact getItem(int position) {
if (mList != null) {
return mList.get(position);
}
return null;
}
Contact c = getItem(position);
//判断是否是匿名用户,如果是的直接return
//点击头像进入个个人信息页面
Intent intent = new Intent(context, PersonalActivity.class);




                intent.putExtra(User.FLAG_LOGIN_NAME,c.getLoginName());
context.startActivity(intent);


Intent intent=new Intent(getActivity(),DynamicDetailsActivity.class);
intent.putExtra("Dynamic",d);
getActivity().startActivity(intent);








android:padding="5dp"  
android:cropToPadding="true"  


EditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {  
       
    @Override  
    public void onFocusChange(View v, boolean hasFocus) {  
        if(hasFocus){//获得焦点  
               
        }else{//失去焦点  
             
        }  
    }             
});


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/light_grey" >


    <ListView
        android:id="@+id/cards_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:divider="@android:color/transparent"
        android:dividerHeight="10dp"
        android:padding="10dp"
        android:scrollbarStyle="outsideOverlay"
        tools:listitem="@layout/list_item_card" />


tools:listitem="@layout/list_item_card" 布局的item


</LinearLayout>






卡片效果
http://blog.csdn.net/qinyuanpei/article/details/17729607 
http://blog.csdn.net/qinyuanpei/article/details/17729607 
https://www.zybuluo.com/flyouting/note/19366
http://www.technology-ebay.de/the-teams/ebay-kleinanzeigen/blog/creating-a-cards-ui-on-android.html


ui组件需要用到的图片是apk包自带的,那么一律用setImageResource或者setBackgroundResource,而不要根据resourceid


注意:get(getResources(), R.drawable.btn_achievement_normal)该方法通过resid转换为drawable,需要考虑回收的问题,如果drawable是对象私有对象,在对象销毁前是肯定不会释放内存的。


有关ListView的一个细节实际上很重要,clipToPadding属性应该被设置成false(默认情况是TRUE),否则的话,Listview的内容区不会滚动到padding区域,下图可以直观的解释: 


ReleaseDynamicActivity  发布动态
ProductListActivity  发布的理财产品
ReleaseProductActivity   发布产品


insideOverlay:默认值,表示在padding区域内并且覆盖在view上
  insideInset:表示在padding区域内并且插入在view后面
  outsideOverlay:表示在padding区域外并且覆盖在view上,推荐这个
  outsideInset:表示在padding区域外并且插入在view后面
 
 https://github.com/rengwuxian/MaterialEditText   android L
http://www.csdn.net/article/2014-11-21/2822753-material-design-libs/2


http://download.csdn.net/download/pgb521dxw/7290255  日期滚轮


mAdapterView.setSelector(getResources().getDrawable(R.color.white));
listDebate.setSelector(new ColorDrawable(Color.TRANSPARENT));
点击是没有难看的颜色
<Button
        android:id="@+id/list_item_card_button_1"
        style="?android:attr/buttonBarButtonStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dip"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:text="是结尾"
        android:textSize="12sp"
        android:textStyle="normal" />


主要是给点击的布局加上背景
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_shortAnimTime">
<item android:drawable="@color/super_light_grey" android:state_focused="true" android:state_pressed="false"/>
<item android:drawable="@color/super_light_grey" android:state_pressed="true"/>
<item android:drawable="@color/white" android:state_focused="false" android:state_pressed="false"/>
<item android:drawable="@color/white"/>
</selector>










http://blog.csdn.net/luffy_1988/article/details/7766624  动画




/**
* 标题栏隐藏
* 在Activity.setCurrentView()之前调用此方法
*/
private void HideTitle() {
// TODO TODO TODO TODO Auto-generated method stub
requestWindowFeature(Window. FEATURE_NO_TITLE );
}


/**
* 隐藏状态栏(全屏)
* 在Activity.setCurrentView()之前调用此方法
*/
private void HideStatusBar() {
// TODO TODO TODO TODO Auto-generated method stub
// 隐藏标题
requestWindowFeature(Window. FEATURE_NO_TITLE );
// 定义全屏参数
int flag=WindowManager.LayoutParams. FLAG_FULLSCREEN ;
// 获得窗口对象
Window myWindow= this.getWindow();
// 设置 Flag 标识
myWindow.setFlags(flag,flag);
}


//弹出键盘
edit.requestFocus();
InputMethodManager imm = (InputMethodManager) edit.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED); 
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);


 <requestFocus />
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);




//键盘弹出事件
public void toggleSoftInput(View et) {
        et.requestFocus();
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);


}




overridePendingTransition(anim.fade_in, anim.fade_in);








        DisplayMetrics metric = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metric);
        int width = metric.widthPixels;  // 屏幕宽度(像素)
        int height = metric.heightPixels;  // 屏幕高度(像素)
        float density = metric.density;  // 屏幕密度(0.75 / 1.0 / 1.5)
        int densityDpi = metric.densityDpi;  // 屏幕密度DPI(120 / 160 / 240)


    但是,需要注意的是,在一个低密度的小屏手机上,仅靠上面的代码是不能获取正确的尺寸的。比如说,一部240x320像素的低密度手机,如果运行上述代码,获取到的屏幕尺寸是320x427。 因此,研究之后发现,若没有设定多分辨率支持的话,Android系统会将240x320的低密度(120)尺寸转换为中等密度(160)对应的尺寸,这 样的话就大大影响了程序的编码。所以,需要在工程的AndroidManifest.xml文件中,加入supports-screens节点,具体的内 容如下:
        <supports-screens
            android:smallScreens="true"
            android:normalScreens="true"
            android:largeScreens="true"
            android:resizeable="true"
            android:anyDensity="true"/>


    这样的话,当前的Android程序就支持了多种分辨率,那么就可以得到正确的物理尺寸了。
 
 
    // 获取屏幕密度(方法1)  
    int screenWidth  = getWindowManager().getDefaultDisplay().getWidth();       // 屏幕宽(像素,如:480px)  
    int screenHeight = getWindowManager().getDefaultDisplay().getHeight();      // 屏幕高(像素,如:800p)  
      
    Log.e(TAG + "  getDefaultDisplay", "screenWidth=" + screenWidth + "; screenHeight=" + screenHeight);  
      
      
    // 获取屏幕密度(方法2)  
    DisplayMetrics dm = new DisplayMetrics();  
    dm = getResources().getDisplayMetrics();  
      
    float density  = dm.density;        // 屏幕密度(像素比例:0.75/1.0/1.5/2.0)  
    int densityDPI = dm.densityDpi;     // 屏幕密度(每寸像素:120/160/240/320)  
    float xdpi = dm.xdpi;             
    float ydpi = dm.ydpi;  
      
    Log.e(TAG + "  DisplayMetrics", "xdpi=" + xdpi + "; ydpi=" + ydpi);  
    Log.e(TAG + "  DisplayMetrics", "density=" + density + "; densityDPI=" + densityDPI);  
      
    screenWidth  = dm.widthPixels;      // 屏幕宽(像素,如:480px)  
    screenHeight = dm.heightPixels;     // 屏幕高(像素,如:800px)  
      
    Log.e(TAG + "  DisplayMetrics(111)", "screenWidth=" + screenWidth + "; screenHeight=" + screenHeight);  
      
      
      
    // 获取屏幕密度(方法3)  
    dm = new DisplayMetrics();  
    getWindowManager().getDefaultDisplay().getMetrics(dm);  
      
    density  = dm.density;      // 屏幕密度(像素比例:0.75/1.0/1.5/2.0)  
    densityDPI = dm.densityDpi;     // 屏幕密度(每寸像素:120/160/240/320)  
    xdpi = dm.xdpi;           
    ydpi = dm.ydpi;  
      
    Log.e(TAG + "  DisplayMetrics", "xdpi=" + xdpi + "; ydpi=" + ydpi);  
    Log.e(TAG + "  DisplayMetrics", "density=" + density + "; densityDPI=" + densityDPI);  
      
    int screenWidthDip = dm.widthPixels;        // 屏幕宽(dip,如:320dip)  
    int screenHeightDip = dm.heightPixels;      // 屏幕宽(dip,如:533dip)  
      
    Log.e(TAG + "  DisplayMetrics(222)", "screenWidthDip=" + screenWidthDip + "; screenHeightDip=" + screenHeightDip);  
      
    screenWidth  = (int)(dm.widthPixels * density + 0.5f);      // 屏幕宽(px,如:480px)  
    screenHeight = (int)(dm.heightPixels * density + 0.5f);     // 屏幕高(px,如:800px)  
      
    Log.e(TAG + "  DisplayMetrics(222)", "screenWidth=" + screenWidth + "; screenHeight=" + screenHeight);




//判断效果


public class MainActivity extends Activity {


  private View msgView;
  private boolean flag = true;
  
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        this.findViewById(R.id.rightButton).setOnClickListener(new OnClickListener() {
          
          @Override
          public void onClick(View arg0) {
              System.out.print("111");
              if(flag){
                  showMsgView();
              }else{
                  closeMsgView();
              }
              flag = !flag;
          }
      });
    }


    private void showMsgView(){
      if(msgView != null){
          msgView.setVisibility(View.VISIBLE);
          return;
      }
      ViewStub stub = (ViewStub)findViewById(R.id.msg_layout);
        msgView = stub.inflate();
    }


    private void closeMsgView(){
      if(msgView != null){
          msgView.setVisibility(View.GONE);
      }
    }
}






一个textview  显示不同的两个颜色
http://blog.csdn.net/luckily01/article/details/7710242


Activity代码: 
 public class TextViewLinkActivity extends Activity {       
TextView myTextView;       
@Override     
 public void onCreate(Bundle savedInstanceState) {           
super.onCreate(savedInstanceState);           
setContentView(R.layout.main);           
myTextView = (TextView) this.findViewById(R.id.myTextView);                      
//创建一个 SpannableString对象          
SpannableString sp = new SpannableString("这句话中有百度超链接,有高亮显示,这样,或者这样,还有斜体.");           
//设置超链接         
 sp.setSpan(new URLSpan("http://www.baidu.com"), 5, 7,                   
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);          
 //设置高亮样式一         
 sp.setSpan(new BackgroundColorSpan(Color.RED), 17 ,19,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);           
//设置高亮样式二          sp.setSpan(new ForegroundColorSpan(Color.YELLOW),20,24,Spannable.SPAN_EXCLUSIVE_INCLUSIVE);             
//设置斜体          
sp.setSpan(new StyleSpan(android.graphics.Typeface.BOLD_ITALIC), 27, 29, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);          
 //SpannableString对象设置给TextView          
myTextView.setText(sp);          
 //设置TextView可点击        
  myTextView.setMovementMethod(LinkMovementMethod.getInstance());      
 }   
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值