• 黑马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;

    }
    }




  • 相关阅读:
    【剑指offer】面试题35:第一个只出现一次的字符
    【剑指offer】面试题34:丑数
    【剑指offer】面试题33:把数组排成最小的数
    【剑指offer】面试题32:从1到n整数中1出现的次数
    【剑指offer】面试题31:连续子数组的最大和
    【剑指offer】面试题30:最小的 k 个数
    【剑指offer】面试题29:数组中出现次数超过一半的数字
    【剑指offer】面试题28:字符串的排列
    【剑指offer】面试题27:二叉搜索树与双向链表
    【剑指offer】面试题26:复杂链表的复制
  • 原文地址:https://www.cnblogs.com/appzhang/p/4868245.html
Copyright © 2020-2023  润新知