zoukankan      html  css  js  c++  java
  • android nagative drawer图标跟标题适配

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    
       <string name="app_name">xxx</string>    
        <string name="navigation_drawer_open">Open navigation drawer</string>
        <string name="navigation_drawer_close">Close navigation drawer</string>
        <string name="action_example">Example action</string>
        <string name="action_settings">Settings</string>
        赵存档 QQ463431476
        <string-array name="sections">
        <item>xxx</item>
      
    </string-array>
    <string-array name="section_titles">
        <item>xxx</item>
       
    </string-array>
    <string-array name="sections_icons">
        <item>@drawable/see</item>
        <item>@drawable/settings</item>
        <item>@drawable/figure</item>
        <item>@drawable/wifi</item>
        <item>@drawable/mic</item>
        <item>@drawable/voice</item>
    </string-array>
    

    http://www.cnblogs.com/xiaobo-Linux/  QQ463431476

    http://www.cnblogs.com/xiaobo-Linux/

    public void onSectionAttached(int number) { //标题 String[] stringArray = getResources().getStringArray(R.array.section_titles); mTitle = stringArray[number-1]; switch (number) { case 1: getSupportFragmentManager().beginTransaction() .replace(R.id.container, new Robot()).commit(); break; } }
      //数据适配器 
            final TypedArray typedArray = getResources().obtainTypedArray(R.array.sections_icons);
            mDrawerListView.setAdapter(new ArrayAdapter<String>(
                    getActionBar().getThemedContext(),
                    android.R.layout.simple_list_item_activated_1,
                    android.R.id.text1,
                    getResources().getStringArray(R.array.sections)
            ) {
                @Override
                public View getView(int position, View convertView, ViewGroup parent) {
                    View v = super.getView(position, convertView, parent);
                    int resourceId = typedArray.getResourceId(position, 0);
                    Drawable drawable = getResources().getDrawable(resourceId);
                    ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
                    return v;
                }
            });
            

    @android:drawable/xxx 是调用sdk安卓系统自带的图片

    C:Program Files (x86)Androidsdkplatformsandroid-15data esdrawable-xhdpi

  • 相关阅读:
    在线|九月月考选填题
    函数$f(x)=e^xpm e^{-x}$相关
    偶函数性质的推广
    2020年全国卷Ⅱ卷文科数学选填题解析版
    2020年全国卷Ⅱ卷文科数学解答题解析版
    待定系数法
    特殊方法求函数解析式
    phd文献阅读日志-4.1
    phd文献阅读日志-1.2~3.2(1.2,2.1,2.2,3.1,3.2)
    完美解决linux下vim在终端不能用鼠标复制的问题
  • 原文地址:https://www.cnblogs.com/zhaocundang/p/5409234.html
Copyright © 2011-2022 走看看