zoukankan      html  css  js  c++  java
  • android activity切换

    activity切换,用intent传递参数

    http://www.cnblogs.com/leipei2352/archive/2011/08/09/2132096.html

    提示:ctrl+alt+space

    补全:ctrl+space

    android studio drawable .xml文件不支持大写的文件名

    Error: 'M' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore

    http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece76310579135480ddd276b97844b22918448e435061e5a25a4ec66644b598f84616606a84f5de0fb3d6f604360eadb9fc80a80fb852859dc30340647c75612a545f28d5125b773875a9feb4ab9e1a62593d88688810344ca255529c1a7dd4d00628a38b14976a3f7ce5f15294ce9b26772ff2f2673cc6313e701aea0256e71d5ad830b5bc35c803250c0f922b04852a156f95f4d2b1bb74cc01f515727e13f7cbe533d75ceb61bf02a081334b639f7ea9fedbd5f8cadbe6ac6addcae5f826090d2eb8921113105ac32bedafde57c390242889dc916b56eefa5bbad4c98458d431ce90c30782bd96ae4958e24e5622ba0bc36a93e23563f0aa9a4758f25232e66fe2918c05f9734&p=9d6ff916d9c10aff57ee94754a448d&newp=c4769a4786cc42af5381df6d424f93231610db2151d6db01298ffe0cc4241a1a1a3aecbf26201306d7c0786104ac425eedf43078330434f1f689df08d2ecce7e&user=baidu&fm=sc&query=%27M%27+is+not+a+valid+file-based+resource+name+character%3A+File-based+res&qid=9756e25300015634&p1=1

    1、在一个activity中完成多个界面的切换,注意在manifest中

    http://zhidao.baidu.com/link?url=0XKU_vzg7Yg5Yj9QFNOWQRLID3u4xFQ3L827oaPwsogcJohx21WgmpmSBcr2Yt-o-oif5_k6aIYqD7QykTH4zOXLT_l3GxPvffbTxQj1ILq

    setContentView(R.layout.main);这句是给activity设置一个layout布局

    你换成LinearLayout LL;
    LL = (LinearLayout) findViewById(R.id.LL);
    setContentView(LL);应该会报空指针吧,
    1、setContentView的作用是将View加载到根view之上,这样当显示view时,先显示根view,然后在显示子view,以此类推,最终将所有view显示出来。
    2、setContentView必须要放在findviewbyid之前,因为view在加载之前是无法引用的。
    3、setContentView最本质的作用是为要显示的view分配内存
    你这边犯了第二条

    因为你没有得到这个Linearlayout所在的布局文件,所以你引用里面的组件是会出错的。

    如果你自己申明一个LinearLayout就不会出错了。比如说:LinearLayout la = new Lin...(this)  setContentView(la)。

    由于手敲,我就不写全了,表达意思,希望你能看懂。

    http://harryalex.iteye.com/blog/2091806

    http://www.cnblogs.com/top5/archive/2013/03/05/2944754.html

    http://blog.csdn.net/yanzi1225627/article/details/7802402

    我的问题,是由于设置了layout了还去find以前layout的对象所以空指针喃,内存都不存在了,fuck

    注意看logcat里的错误提示,错误出现在哪了什么的

  • 相关阅读:
    剑指offer-二维数组中的查找
    TF-IDF(term frequency–inverse document frequency)
    Java实现中文字符串的排序功能
    当前课程
    【R】资源整理
    CentOS相关
    【转】Setting up SDL Extension Libraries on MinGW
    【转】Setting up SDL Extension Libraries on Visual Studio 2010 Ultimate
    【转】Setting up SDL Extension Libraries on Code::Blocks 12.11
    【转】Setting up SDL Extension Libraries on Visual Studio 2019 Community
  • 原文地址:https://www.cnblogs.com/lwhp/p/5634735.html
Copyright © 2011-2022 走看看