zoukankan      html  css  js  c++  java
  • 黑马android

    day55

    1、AndroidManifest.xml 中对某个Activity设置全屏:android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

    2、(image)View.setBackgroundResource() 这种情况会全屏设置背景

    3、drawable文件夹下的selector.xml文件, selector一定要放在最后面,否则会报错。

    day56

    padding由内向外扩充

    android:weightSum 权重之和

    320*240 (0.75)   480*320(1)   480*800(1.5)  1280*720(2)

    googled电子市场

    1、actionbar 3.0之后采用的,所以兼容版本必须在11之上

    <menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
    <item android:id="@+id/action_settings"
    android:icon="@drawable/ic_action_search"
    android:title="搜索" // -- 有图标的话,这个就是在点击图标之后的提示文字
    android:orderInCategory="100"
    app:showAsAction="ifRoom" />
    </menu>
    关于actionbar不显示logo的处理方法
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setLogo(R.drawable.ic_action_logo);
    actionBar.setDisplayUseLogoEnabled(true);

    在actionbar上显示后退按钮并实现功能,有两种处理方法。第一种是首先添加上面显示logo的附加代码,然后再添加一行显示回退箭头的代码,如下:
    actionBar.setDisplayHomeAsUpEnabled(true);
    然后在点击事件处理中,如下处理即可
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()){
         case android.R.id.home:finish();break;
    }
    第二种方法是不写点击处理事件,直接在manifest文件中配置,形如如下代码
    <activity
    android:name=".SecondActivity"
    android:label="@string/title_activity_second"
    android:parentActivityName=".MainActivity">
    <meta-data
    android:name="android.support.PARENT_ACTIVITY"
    android:value=".MainActivity" />
    </activity>

    arraylist查询比较快 linkedlist增删比较快。

    View view = View.inflate(Context,Resource,ViewGroup) 可以直接根据xml文件构造一个view

    Fragment工厂的构建:

    public class FragmentFactory {

    private static Map<Integer, Fragment> mFragments = new HashMap<Integer, Fragment>();

    public static Fragment createFragment(int position) {
    Fragment fragment = null;
    fragment = mFragments.get(position); //在集合中取出来Fragment
    if (fragment == null) { //如果再集合中没有取出来 需要重新创建
    if (position == 0) {
    fragment = new HomeFragment();
    } else if (position == 1) {
    fragment = new AppFragment();
    } else if (position == 2) {
    fragment = new GameFragment();
    } else if (position == 3) {
    fragment = new SubjectFragment();
    } else if (position == 4) {
    fragment = new CategoryFragment();
    } else if (position == 5) {
    fragment = new TopFragment();
    }
    if (fragment != null) {
    mFragments.put(position, fragment);// 把创建好的Fragment存放到集合中缓存起来
    }
    }
    return fragment;

    }
    }




  • 相关阅读:
    Method "goodsList" has already been defined as a data property
    mac安装淘宝淘宝镜像失败
    webstrom git配置设置时右侧没有内容 select configuration element in the tree to edit its setting
    vue下标获取数据时候,页面报错
    透明度全兼容
    clipboard冲突mui.css,移动端实现复制粘贴
    Vue价格四舍五入保留两位和直接取两位
    实习大总结
    day33
    day31
  • 原文地址:https://www.cnblogs.com/appzhang/p/4868245.html
Copyright © 2011-2022 走看看