Skip to main content
se eliminaron 15 caracteres en el cuerpo
Origen Enlace
SoCu
  • 468
  • 1
  • 7
  • 22
import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.widget.Toast;

import com.SoCu.Docu_AA.custom_views.HorizontalScrollMenuView;
import com.SoCu.Docu_AA.extras.MenuItem;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public class MainActivity extends AppCompatActivity {

private ViewPager viewPager;
HorizontalScrollMenuView horizontal_menu;


private TextView Texto_Titulo;
private Typeface Fuente_kunstler;

private Toolbar toolbar; 
private DrawerLayout mDrawerLayout;
private ExpandableListView mDrawerExpandableList;
private ActionBarDrawerToggle mDrawerToggle;

private CharSequence mDrawerTitle;
private CharSequence mTitle;

private List<String> grupos;
private HashMap<String, List<String>> datosGrupos;
private int ultimaPosicionExpList = -1;
private MyAdapter adapter;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar); 

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(R.mipmap.ic_launcher_round);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //hacer lo que quieras
            onBackPressed();
        }
    });


// -------- 1111 --------------- CODIGO PARA EL MENU LATERAL -----------------------------


    //mDrawerTitle = getTitle();
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerExpandableList = (ExpandableListView) findViewById(R.id.explist_slidermenu);
    mDrawerExpandableList.setGroupIndicator(null);//Indicador flecha desplegable izquierda oculta

    //A continuación añadimos cabecera general...
    View header = getLayoutInflater().inflate(R.layout.cabecera_general, null);
    mDrawerExpandableList.addHeaderView(header, null, false);
    //...y pie de página
    View footer = getLayoutInflater().inflate(R.layout.pie_pagina, null);
    mDrawerExpandableList.addFooterView(footer, null, false);

    cargarDatos();


    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close) {

    };

    mDrawerToggle.setDrawerIndicatorEnabled(true); 
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mDrawerExpandableList.setTextFilterEnabled(true);
    mDrawerExpandableList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            return false;
        }
    });
    mDrawerExpandableList.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
        @Override
        public void onGroupExpand(int groupPosition) {
            if (ultimaPosicionExpList != -1 && groupPosition != ultimaPosicionExpList) {
                mDrawerExpandableList.collapseGroup(ultimaPosicionExpList);
            }
            ultimaPosicionExpList = groupPosition;
        }
    });
    mDrawerExpandableList.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
        @Override
        public void onGroupCollapse(int groupPosition) {

        }
    });

    mDrawerExpandableList.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            int grup_pos = (int)adapter.getGroupId(groupPosition);
            int child_pos = (int)adapter.getChildId(groupPosition, childPosition);
            if(grup_pos == 0) {
                switch (child_pos) {
                    case 0:

                        displayView( 0 );  //Elc_Elc

                        break;
                    case 1:
                        displayView( 1 );  // Cre_Cre
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 1) {
                switch (child_pos) {
                    case 0:
                        displayView( 2 );  // San_V
                        break;
                    case 1:
                        displayView( 3 );  // Saaa_Saaa
                        break;
                    case 2:
                        displayView( 4 );  // Eld_Eld
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 2) {
                switch (child_pos) {
                    case 0:
                        displayView( 5 );  // Monforte PLO
                        break;
                    default:
                        break;
                }
            }
            //if(grup_pos == 3) {
            //Acciones
            //}
            mDrawerLayout.closeDrawer(mDrawerExpandableList);
            return false;
        }
    });

    if (savedInstanceState == null) {
        displayView(0);
    }


// ---------1111-------------------------------------------------------------------------


    horizontal_menu = (HorizontalScrollMenuView) findViewById(R.id.horizontal_menu);
    viewPager = (ViewPager) findViewById(R.id.pager);

    horizontal_menu.addItem("Telefonos", R.drawable.menu1_icon,true);
    horizontal_menu.addItem("Navegador GPS", R.drawable.menu2_icon );
    horizontal_menu.addItem("Menu 2", R.drawable.menu3_icon );
    horizontal_menu.addItem("Menu 3", R.drawable.menu4_icon );
    horizontal_menu.addItem("Menu 4", R.drawable.menu5_icon );
    horizontal_menu.addItem("Menu 5", R.drawable.menu6_icon );
    horizontal_menu.addItem("Menu 6", R.drawable.menu7_icon );
    horizontal_menu.addItem("Menu 7", R.drawable.gps3_icon);

    horizontal_menu.showItems();


    PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(pagerAdapter);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            horizontal_menu.setItemSelected(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });

    horizontal_menu.setOnHSMenuClickListener(new HorizontalScrollMenuView.OnHSMenuClickListener() {
        @Override
        public void onHSMClick(MenuItem menuItem, int position) {
            viewPager.setCurrentItem(position);
        }
    });

}   //llave que cierra el oncreate



// -------- 2222 --------------- CODIGO PARA EL MENU LATERAL -----------------------------

private void cargarDatos() {

    grupos = new ArrayList<String>();
    datosGrupos = new HashMap<String, List<String>>();

    grupos.add("Menu Lateral 1");
    grupos.add("Menu Lateral 2");
    grupos.add("Menu Lateral 3");
    //grupos.add("Grupo 4");

    List<String> hijos_grupo1 = new ArrayList<String>();
    hijos_grupo1.add("Elc");
    hijos_grupo1.add("Cre");

    List<String> hijos_grupo2 = new ArrayList<String>();
    hijos_grupo2.add("San V.");
    hijos_grupo2.add("Saaa");
    hijos_grupo2.add("Eld");

    List<String> hijos_grupo3 = new ArrayList<String>();
    hijos_grupo3.add("Mon_PLO");

    //List<String> hijos_grupo4 = new ArrayList<String>();
    //hijos_grupo4.add("Hijo 1 de grupo 4");
    //hijos_grupo4.add("Hijo 2 de grupo 4");
    //hijos_grupo4.add("Hijo 3 de grupo 4");
    //hijos_grupo4.add("Hijo 4 de grupo 4");

    datosGrupos.put(grupos.get(0), hijos_grupo1);
    datosGrupos.put(grupos.get(1), hijos_grupo2);
    datosGrupos.put(grupos.get(2), hijos_grupo3);
    //datosGrupos.put(grupos.get(3), hijos_grupo4);

    adapter = new MyAdapter(this, grupos, datosGrupos);
    mDrawerExpandableList.setAdapter(adapter);
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void displayView(int position) {
    Fragment fragment = null;
    switch (position) {
        case 0:
            fragment = new Elc_Elc();
            break;
        case 1:
            fragment = new Cre_Cre();
            break;
        case 2:
            fragment = new SanV_SanV();
            break;
        case 3:
            fragment = new Saaa_Saaa();
            break;
        case 4:
            fragment = new Eld_Eld();
            break;
        case 5:
            fragment = new MoPLO_MoPLO();
            break;
        default:
            //fragment = new Elc_Elc();
            break;
    }

}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mDrawerToggle.syncState();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    mDrawerToggle.onConfigurationChanged(newConfig);
}


// ---------2222-------------------------------------------------------------------------


//crea el menu de opciones en el Toolbar
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_opciones, menu);
    return true;
}


@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:  
            onBackPressed();     
            return true;         

        case R.id.m_acerca:
            Toast toast = new Toast(getApplicationContext());
            toast.setGravity( Gravity.CENTER,0,0);
            TextView tv = new TextView(MainActivity.this);
            tv.setBackgroundColor( Color.RED);
            tv.setTextColor(Color.YELLOW);
            tv.setTextSize(20);
            Typeface t = Typeface.create("serif", Typeface.BOLD_ITALIC);
            tv.setTypeface(t);
            tv.setPadding(10,10,10,10);
            TextView versionname = (TextView) findViewById(R.id.ver_name);
            tv.setText("version : " + BuildConfig.VERSION_NAME);
            toast.setView(tv);
            toast.setDuration(Toast.LENGTH_LONG);
            toast.show();
            return true;

        case R.id.m_salir:
            //finish();
            onBackPressed();
    }
    return super.onOptionsItemSelected(item);
}


@Override
public void onBackPressed(){
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setIcon(R.drawable.icon_stop_1);
        builder.setMessage("Quieres salir de la aplicación?");
        builder.setTitle("Cerrar xxxx");
        builder.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        });

        AlertDialog dialog=builder.create();
        dialog.show();
    }



private class PagerAdapter extends FragmentPagerAdapter {
    PagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                return new Telefonos();
            case 1:
                return new Navegador_GPS();
            case 2:
                return new Menu_2();
            case 3:
                return new Menu_3();
            case 4:
                return new Menu_4();
            case 5:
                return new Menu_5();
            case 6:
                return new Menu_6();
            case 7:
                return new Menu_7();
            default:
                return new Telefonos();
        }
    }

    @Override
    public int getCount() {
        return 8;
    }

}

}

activity_main.xml <android.support.v4.widget.DrawerLayout 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" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.SoCu.CirDocucontext=".MainActivity" tools:openDrawer="start">

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        app:titleTextColor="@android:color/white"
        app:layout_collapseMode="pin"
        android:elevation="4dp"
        app:popupTheme="@style/AppTheme.FondoMenu"
        app:theme="@style/ThemeOverlay.AppCompat.Dark"/>

    <com.SoCu.Docu_Adif.custom_views.HorizontalScrollMenuView
        android:id="@+id/horizontal_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:backgroundMenuColor="#0099cc"
        app:backgroundNotifications="@color/colorAccent"
        app:icon_height="30dp"
        app:icon_width="30dp"
        app:item_backgroundColor="@color/colorPrimary"
        app:item_colorSelected="#ffffff"
        app:item_textColor="#ffffff" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <TextView
        android:id="@+id/ver_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

<ExpandableListView
    android:id="@+id/explist_slidermenu"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="#A4C739"
    android:background="#FFFFFF"
    android:dividerHeight="0.5dp"
    android:listSelector="#bfbfbf"
    />

</android.support.v4.widget.DrawerLayout>
import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.widget.Toast;

import com.SoCu.Docu_A.custom_views.HorizontalScrollMenuView;
import com.SoCu.Docu_A.extras.MenuItem;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public class MainActivity extends AppCompatActivity {

private ViewPager viewPager;
HorizontalScrollMenuView horizontal_menu;


private TextView Texto_Titulo;
private Typeface Fuente_kunstler;

private Toolbar toolbar; 
private DrawerLayout mDrawerLayout;
private ExpandableListView mDrawerExpandableList;
private ActionBarDrawerToggle mDrawerToggle;

private CharSequence mDrawerTitle;
private CharSequence mTitle;

private List<String> grupos;
private HashMap<String, List<String>> datosGrupos;
private int ultimaPosicionExpList = -1;
private MyAdapter adapter;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar); 

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(R.mipmap.ic_launcher_round);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //hacer lo que quieras
            onBackPressed();
        }
    });


// -------- 1111 --------------- CODIGO PARA EL MENU LATERAL -----------------------------


    //mDrawerTitle = getTitle();
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerExpandableList = (ExpandableListView) findViewById(R.id.explist_slidermenu);
    mDrawerExpandableList.setGroupIndicator(null);//Indicador flecha desplegable izquierda oculta

    //A continuación añadimos cabecera general...
    View header = getLayoutInflater().inflate(R.layout.cabecera_general, null);
    mDrawerExpandableList.addHeaderView(header, null, false);
    //...y pie de página
    View footer = getLayoutInflater().inflate(R.layout.pie_pagina, null);
    mDrawerExpandableList.addFooterView(footer, null, false);

    cargarDatos();


    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close) {

    };

    mDrawerToggle.setDrawerIndicatorEnabled(true); 
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mDrawerExpandableList.setTextFilterEnabled(true);
    mDrawerExpandableList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            return false;
        }
    });
    mDrawerExpandableList.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
        @Override
        public void onGroupExpand(int groupPosition) {
            if (ultimaPosicionExpList != -1 && groupPosition != ultimaPosicionExpList) {
                mDrawerExpandableList.collapseGroup(ultimaPosicionExpList);
            }
            ultimaPosicionExpList = groupPosition;
        }
    });
    mDrawerExpandableList.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
        @Override
        public void onGroupCollapse(int groupPosition) {

        }
    });

    mDrawerExpandableList.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            int grup_pos = (int)adapter.getGroupId(groupPosition);
            int child_pos = (int)adapter.getChildId(groupPosition, childPosition);
            if(grup_pos == 0) {
                switch (child_pos) {
                    case 0:

                        displayView( 0 );  //Elc_Elc

                        break;
                    case 1:
                        displayView( 1 );  // Cre_Cre
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 1) {
                switch (child_pos) {
                    case 0:
                        displayView( 2 );  // San_V
                        break;
                    case 1:
                        displayView( 3 );  // Saaa_Saaa
                        break;
                    case 2:
                        displayView( 4 );  // Eld_Eld
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 2) {
                switch (child_pos) {
                    case 0:
                        displayView( 5 );  // Monforte PLO
                        break;
                    default:
                        break;
                }
            }
            //if(grup_pos == 3) {
            //Acciones
            //}
            mDrawerLayout.closeDrawer(mDrawerExpandableList);
            return false;
        }
    });

    if (savedInstanceState == null) {
        displayView(0);
    }


// ---------1111-------------------------------------------------------------------------


    horizontal_menu = (HorizontalScrollMenuView) findViewById(R.id.horizontal_menu);
    viewPager = (ViewPager) findViewById(R.id.pager);

    horizontal_menu.addItem("Telefonos", R.drawable.menu1_icon,true);
    horizontal_menu.addItem("Navegador GPS", R.drawable.menu2_icon );
    horizontal_menu.addItem("Menu 2", R.drawable.menu3_icon );
    horizontal_menu.addItem("Menu 3", R.drawable.menu4_icon );
    horizontal_menu.addItem("Menu 4", R.drawable.menu5_icon );
    horizontal_menu.addItem("Menu 5", R.drawable.menu6_icon );
    horizontal_menu.addItem("Menu 6", R.drawable.menu7_icon );
    horizontal_menu.addItem("Menu 7", R.drawable.gps3_icon);

    horizontal_menu.showItems();


    PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(pagerAdapter);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            horizontal_menu.setItemSelected(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });

    horizontal_menu.setOnHSMenuClickListener(new HorizontalScrollMenuView.OnHSMenuClickListener() {
        @Override
        public void onHSMClick(MenuItem menuItem, int position) {
            viewPager.setCurrentItem(position);
        }
    });

}   //llave que cierra el oncreate



// -------- 2222 --------------- CODIGO PARA EL MENU LATERAL -----------------------------

private void cargarDatos() {

    grupos = new ArrayList<String>();
    datosGrupos = new HashMap<String, List<String>>();

    grupos.add("Menu Lateral 1");
    grupos.add("Menu Lateral 2");
    grupos.add("Menu Lateral 3");
    //grupos.add("Grupo 4");

    List<String> hijos_grupo1 = new ArrayList<String>();
    hijos_grupo1.add("Elc");
    hijos_grupo1.add("Cre");

    List<String> hijos_grupo2 = new ArrayList<String>();
    hijos_grupo2.add("San V.");
    hijos_grupo2.add("Saaa");
    hijos_grupo2.add("Eld");

    List<String> hijos_grupo3 = new ArrayList<String>();
    hijos_grupo3.add("Mon_PLO");

    //List<String> hijos_grupo4 = new ArrayList<String>();
    //hijos_grupo4.add("Hijo 1 de grupo 4");
    //hijos_grupo4.add("Hijo 2 de grupo 4");
    //hijos_grupo4.add("Hijo 3 de grupo 4");
    //hijos_grupo4.add("Hijo 4 de grupo 4");

    datosGrupos.put(grupos.get(0), hijos_grupo1);
    datosGrupos.put(grupos.get(1), hijos_grupo2);
    datosGrupos.put(grupos.get(2), hijos_grupo3);
    //datosGrupos.put(grupos.get(3), hijos_grupo4);

    adapter = new MyAdapter(this, grupos, datosGrupos);
    mDrawerExpandableList.setAdapter(adapter);
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void displayView(int position) {
    Fragment fragment = null;
    switch (position) {
        case 0:
            fragment = new Elc_Elc();
            break;
        case 1:
            fragment = new Cre_Cre();
            break;
        case 2:
            fragment = new SanV_SanV();
            break;
        case 3:
            fragment = new Saaa_Saaa();
            break;
        case 4:
            fragment = new Eld_Eld();
            break;
        case 5:
            fragment = new MoPLO_MoPLO();
            break;
        default:
            //fragment = new Elc_Elc();
            break;
    }

}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mDrawerToggle.syncState();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    mDrawerToggle.onConfigurationChanged(newConfig);
}


// ---------2222-------------------------------------------------------------------------


//crea el menu de opciones en el Toolbar
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_opciones, menu);
    return true;
}


@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:  
            onBackPressed();     
            return true;         

        case R.id.m_acerca:
            Toast toast = new Toast(getApplicationContext());
            toast.setGravity( Gravity.CENTER,0,0);
            TextView tv = new TextView(MainActivity.this);
            tv.setBackgroundColor( Color.RED);
            tv.setTextColor(Color.YELLOW);
            tv.setTextSize(20);
            Typeface t = Typeface.create("serif", Typeface.BOLD_ITALIC);
            tv.setTypeface(t);
            tv.setPadding(10,10,10,10);
            TextView versionname = (TextView) findViewById(R.id.ver_name);
            tv.setText("version : " + BuildConfig.VERSION_NAME);
            toast.setView(tv);
            toast.setDuration(Toast.LENGTH_LONG);
            toast.show();
            return true;

        case R.id.m_salir:
            //finish();
            onBackPressed();
    }
    return super.onOptionsItemSelected(item);
}


@Override
public void onBackPressed(){
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setIcon(R.drawable.icon_stop_1);
        builder.setMessage("Quieres salir de la aplicación?");
        builder.setTitle("Cerrar xxxx");
        builder.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        });

        AlertDialog dialog=builder.create();
        dialog.show();
    }



private class PagerAdapter extends FragmentPagerAdapter {
    PagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                return new Telefonos();
            case 1:
                return new Navegador_GPS();
            case 2:
                return new Menu_2();
            case 3:
                return new Menu_3();
            case 4:
                return new Menu_4();
            case 5:
                return new Menu_5();
            case 6:
                return new Menu_6();
            case 7:
                return new Menu_7();
            default:
                return new Telefonos();
        }
    }

    @Override
    public int getCount() {
        return 8;
    }

}

}

activity_main.xml <android.support.v4.widget.DrawerLayout 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" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.SoCu.CirDocu.MainActivity" tools:openDrawer="start">

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        app:titleTextColor="@android:color/white"
        app:layout_collapseMode="pin"
        android:elevation="4dp"
        app:popupTheme="@style/AppTheme.FondoMenu"
        app:theme="@style/ThemeOverlay.AppCompat.Dark"/>

    <com.SoCu.Docu_Adif.custom_views.HorizontalScrollMenuView
        android:id="@+id/horizontal_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:backgroundMenuColor="#0099cc"
        app:backgroundNotifications="@color/colorAccent"
        app:icon_height="30dp"
        app:icon_width="30dp"
        app:item_backgroundColor="@color/colorPrimary"
        app:item_colorSelected="#ffffff"
        app:item_textColor="#ffffff" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <TextView
        android:id="@+id/ver_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

<ExpandableListView
    android:id="@+id/explist_slidermenu"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="#A4C739"
    android:background="#FFFFFF"
    android:dividerHeight="0.5dp"
    android:listSelector="#bfbfbf"
    />

</android.support.v4.widget.DrawerLayout>
import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.widget.Toast;

import com.A.custom_views.HorizontalScrollMenuView;
import com.A.extras.MenuItem;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public class MainActivity extends AppCompatActivity {

private ViewPager viewPager;
HorizontalScrollMenuView horizontal_menu;


private TextView Texto_Titulo;
private Typeface Fuente_kunstler;

private Toolbar toolbar; 
private DrawerLayout mDrawerLayout;
private ExpandableListView mDrawerExpandableList;
private ActionBarDrawerToggle mDrawerToggle;

private CharSequence mDrawerTitle;
private CharSequence mTitle;

private List<String> grupos;
private HashMap<String, List<String>> datosGrupos;
private int ultimaPosicionExpList = -1;
private MyAdapter adapter;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar); 

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(R.mipmap.ic_launcher_round);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //hacer lo que quieras
            onBackPressed();
        }
    });


// -------- 1111 --------------- CODIGO PARA EL MENU LATERAL -----------------------------


    //mDrawerTitle = getTitle();
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerExpandableList = (ExpandableListView) findViewById(R.id.explist_slidermenu);
    mDrawerExpandableList.setGroupIndicator(null);//Indicador flecha desplegable izquierda oculta

    //A continuación añadimos cabecera general...
    View header = getLayoutInflater().inflate(R.layout.cabecera_general, null);
    mDrawerExpandableList.addHeaderView(header, null, false);
    //...y pie de página
    View footer = getLayoutInflater().inflate(R.layout.pie_pagina, null);
    mDrawerExpandableList.addFooterView(footer, null, false);

    cargarDatos();


    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close) {

    };

    mDrawerToggle.setDrawerIndicatorEnabled(true); 
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mDrawerExpandableList.setTextFilterEnabled(true);
    mDrawerExpandableList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            return false;
        }
    });
    mDrawerExpandableList.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
        @Override
        public void onGroupExpand(int groupPosition) {
            if (ultimaPosicionExpList != -1 && groupPosition != ultimaPosicionExpList) {
                mDrawerExpandableList.collapseGroup(ultimaPosicionExpList);
            }
            ultimaPosicionExpList = groupPosition;
        }
    });
    mDrawerExpandableList.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
        @Override
        public void onGroupCollapse(int groupPosition) {

        }
    });

    mDrawerExpandableList.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            int grup_pos = (int)adapter.getGroupId(groupPosition);
            int child_pos = (int)adapter.getChildId(groupPosition, childPosition);
            if(grup_pos == 0) {
                switch (child_pos) {
                    case 0:

                        displayView( 0 );  //Elc_Elc

                        break;
                    case 1:
                        displayView( 1 );  // Cre_Cre
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 1) {
                switch (child_pos) {
                    case 0:
                        displayView( 2 );  // San_V
                        break;
                    case 1:
                        displayView( 3 );  // Saaa_Saaa
                        break;
                    case 2:
                        displayView( 4 );  // Eld_Eld
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 2) {
                switch (child_pos) {
                    case 0:
                        displayView( 5 );  // Monforte PLO
                        break;
                    default:
                        break;
                }
            }
            //if(grup_pos == 3) {
            //Acciones
            //}
            mDrawerLayout.closeDrawer(mDrawerExpandableList);
            return false;
        }
    });

    if (savedInstanceState == null) {
        displayView(0);
    }


// ---------1111-------------------------------------------------------------------------


    horizontal_menu = (HorizontalScrollMenuView) findViewById(R.id.horizontal_menu);
    viewPager = (ViewPager) findViewById(R.id.pager);

    horizontal_menu.addItem("Telefonos", R.drawable.menu1_icon,true);
    horizontal_menu.addItem("Navegador GPS", R.drawable.menu2_icon );
    horizontal_menu.addItem("Menu 2", R.drawable.menu3_icon );
    horizontal_menu.addItem("Menu 3", R.drawable.menu4_icon );
    horizontal_menu.addItem("Menu 4", R.drawable.menu5_icon );
    horizontal_menu.addItem("Menu 5", R.drawable.menu6_icon );
    horizontal_menu.addItem("Menu 6", R.drawable.menu7_icon );
    horizontal_menu.addItem("Menu 7", R.drawable.gps3_icon);

    horizontal_menu.showItems();


    PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(pagerAdapter);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            horizontal_menu.setItemSelected(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });

    horizontal_menu.setOnHSMenuClickListener(new HorizontalScrollMenuView.OnHSMenuClickListener() {
        @Override
        public void onHSMClick(MenuItem menuItem, int position) {
            viewPager.setCurrentItem(position);
        }
    });

}   //llave que cierra el oncreate



// -------- 2222 --------------- CODIGO PARA EL MENU LATERAL -----------------------------

private void cargarDatos() {

    grupos = new ArrayList<String>();
    datosGrupos = new HashMap<String, List<String>>();

    grupos.add("Menu Lateral 1");
    grupos.add("Menu Lateral 2");
    grupos.add("Menu Lateral 3");
    //grupos.add("Grupo 4");

    List<String> hijos_grupo1 = new ArrayList<String>();
    hijos_grupo1.add("Elc");
    hijos_grupo1.add("Cre");

    List<String> hijos_grupo2 = new ArrayList<String>();
    hijos_grupo2.add("San V.");
    hijos_grupo2.add("Saaa");
    hijos_grupo2.add("Eld");

    List<String> hijos_grupo3 = new ArrayList<String>();
    hijos_grupo3.add("Mon_PLO");

    //List<String> hijos_grupo4 = new ArrayList<String>();
    //hijos_grupo4.add("Hijo 1 de grupo 4");
    //hijos_grupo4.add("Hijo 2 de grupo 4");
    //hijos_grupo4.add("Hijo 3 de grupo 4");
    //hijos_grupo4.add("Hijo 4 de grupo 4");

    datosGrupos.put(grupos.get(0), hijos_grupo1);
    datosGrupos.put(grupos.get(1), hijos_grupo2);
    datosGrupos.put(grupos.get(2), hijos_grupo3);
    //datosGrupos.put(grupos.get(3), hijos_grupo4);

    adapter = new MyAdapter(this, grupos, datosGrupos);
    mDrawerExpandableList.setAdapter(adapter);
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void displayView(int position) {
    Fragment fragment = null;
    switch (position) {
        case 0:
            fragment = new Elc_Elc();
            break;
        case 1:
            fragment = new Cre_Cre();
            break;
        case 2:
            fragment = new SanV_SanV();
            break;
        case 3:
            fragment = new Saaa_Saaa();
            break;
        case 4:
            fragment = new Eld_Eld();
            break;
        case 5:
            fragment = new MoPLO_MoPLO();
            break;
        default:
            //fragment = new Elc_Elc();
            break;
    }

}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mDrawerToggle.syncState();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    mDrawerToggle.onConfigurationChanged(newConfig);
}


// ---------2222-------------------------------------------------------------------------


//crea el menu de opciones en el Toolbar
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_opciones, menu);
    return true;
}


@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:  
            onBackPressed();     
            return true;         

        case R.id.m_acerca:
            Toast toast = new Toast(getApplicationContext());
            toast.setGravity( Gravity.CENTER,0,0);
            TextView tv = new TextView(MainActivity.this);
            tv.setBackgroundColor( Color.RED);
            tv.setTextColor(Color.YELLOW);
            tv.setTextSize(20);
            Typeface t = Typeface.create("serif", Typeface.BOLD_ITALIC);
            tv.setTypeface(t);
            tv.setPadding(10,10,10,10);
            TextView versionname = (TextView) findViewById(R.id.ver_name);
            tv.setText("version : " + BuildConfig.VERSION_NAME);
            toast.setView(tv);
            toast.setDuration(Toast.LENGTH_LONG);
            toast.show();
            return true;

        case R.id.m_salir:
            //finish();
            onBackPressed();
    }
    return super.onOptionsItemSelected(item);
}


@Override
public void onBackPressed(){
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setIcon(R.drawable.icon_stop_1);
        builder.setMessage("Quieres salir de la aplicación?");
        builder.setTitle("Cerrar xxxx");
        builder.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        });

        AlertDialog dialog=builder.create();
        dialog.show();
    }



private class PagerAdapter extends FragmentPagerAdapter {
    PagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                return new Telefonos();
            case 1:
                return new Navegador_GPS();
            case 2:
                return new Menu_2();
            case 3:
                return new Menu_3();
            case 4:
                return new Menu_4();
            case 5:
                return new Menu_5();
            case 6:
                return new Menu_6();
            case 7:
                return new Menu_7();
            default:
                return new Telefonos();
        }
    }

    @Override
    public int getCount() {
        return 8;
    }

}

}

activity_main.xml <android.support.v4.widget.DrawerLayout 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" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".MainActivity" tools:openDrawer="start">

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        app:titleTextColor="@android:color/white"
        app:layout_collapseMode="pin"
        android:elevation="4dp"
        app:popupTheme="@style/AppTheme.FondoMenu"
        app:theme="@style/ThemeOverlay.AppCompat.Dark"/>

    <com.custom_views.HorizontalScrollMenuView
        android:id="@+id/horizontal_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:backgroundMenuColor="#0099cc"
        app:backgroundNotifications="@color/colorAccent"
        app:icon_height="30dp"
        app:icon_width="30dp"
        app:item_backgroundColor="@color/colorPrimary"
        app:item_colorSelected="#ffffff"
        app:item_textColor="#ffffff" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <TextView
        android:id="@+id/ver_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

<ExpandableListView
    android:id="@+id/explist_slidermenu"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="#A4C739"
    android:background="#FFFFFF"
    android:dividerHeight="0.5dp"
    android:listSelector="#bfbfbf"
    />

</android.support.v4.widget.DrawerLayout>
se añadieron 11619 caracteres en el cuerpo
Origen Enlace
SoCu
  • 468
  • 1
  • 7
  • 22

He probado a crear los menús por separado y cada uno funciona bien, pero a la hora de juntarlos en el MainActivity empiezan los problemas, parece que hay conflicto con en los import:

import android.app.Fragment;
import android.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.support.v4.view.PagerAdapter;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void displayView(int position) {
    Fragment fragment = null;
    switch (position) {
        case 0:
            fragment = new Elc();
            break;
        case 1:
            fragment = new Cre();
            break;
        case 2:
            fragment = new San_V();
            break;
        case 3:
            fragment = new Sa();
            break;
        case 4:
            fragment = new Eld();
            break;
        case 5:
            fragment = new Mo_PLO();
            break;
        default:
            //fragment = new Elc();
            break;
    }


    if (fragment != null) {
        //android.app.FragmentManager fragmentManager = getFragmentManager();
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction()
                .replace(R.id.frame_container, fragment).commit();

        mDrawerExpandableList.setItemChecked(position, true);
        mDrawerExpandableList.setSelection(position);
        //setTitle(grupos.get(position));
        getSupportActionBar().setTitle(mDrawerTitle);
        getSupportActionBar().setSubtitle(mTitle);
        mDrawerLayout.closeDrawer(mDrawerExpandableList);
    } else {
        Log.e("Aviso", "Error cuando se crea el fragment");
    }

}

Y éste es el código que tengo puesto para el menú horizontal del TabLayout, que al tener sus import correspondientes no muestra errores:

private class PagerAdapter extends FragmentPagerAdapter {
import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.widget.Toast;

import com.SoCu.Docu_A.custom_views.HorizontalScrollMenuView;
import com.SoCu.Docu_A.extras.MenuItem;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public class MainActivity extends AppCompatActivity {

private ViewPager viewPager;
HorizontalScrollMenuView horizontal_menu;


private TextView Texto_Titulo;
private Typeface Fuente_kunstler;

private Toolbar toolbar; 
private DrawerLayout mDrawerLayout;
private ExpandableListView mDrawerExpandableList;
private ActionBarDrawerToggle mDrawerToggle;

private CharSequence mDrawerTitle;
private CharSequence mTitle;

private List<String> grupos;
private HashMap<String, List<String>> datosGrupos;
private int ultimaPosicionExpList = -1;
private MyAdapter adapter;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar); 

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(R.mipmap.ic_launcher_round);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //hacer lo que quieras
            onBackPressed();
        }
    });


// -------- 1111 --------------- CODIGO PARA EL MENU LATERAL -----------------------------


    //mDrawerTitle = getTitle();
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerExpandableList = (ExpandableListView) findViewById(R.id.explist_slidermenu);
    mDrawerExpandableList.setGroupIndicator(null);//Indicador flecha desplegable izquierda oculta

    //A continuación añadimos cabecera general...
    View header = getLayoutInflater().inflate(R.layout.cabecera_general, null);
    mDrawerExpandableList.addHeaderView(header, null, false);
    //...y pie de página
    View footer = getLayoutInflater().inflate(R.layout.pie_pagina, null);
    mDrawerExpandableList.addFooterView(footer, null, false);

    cargarDatos();


    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close) {

    };

    mDrawerToggle.setDrawerIndicatorEnabled(true); 
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mDrawerExpandableList.setTextFilterEnabled(true);
    mDrawerExpandableList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            return false;
        }
    });
    mDrawerExpandableList.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
        @Override
        public void onGroupExpand(int groupPosition) {
            if (ultimaPosicionExpList != -1 && groupPosition != ultimaPosicionExpList) {
                mDrawerExpandableList.collapseGroup(ultimaPosicionExpList);
            }
            ultimaPosicionExpList = groupPosition;
        }
    });
    mDrawerExpandableList.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
        @Override
        public void onGroupCollapse(int groupPosition) {

        }
    });

    mDrawerExpandableList.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            int grup_pos = (int)adapter.getGroupId(groupPosition);
            int child_pos = (int)adapter.getChildId(groupPosition, childPosition);
            if(grup_pos == 0) {
                switch (child_pos) {
                    case 0:

                        displayView( 0 );  //Elc_Elc

                        break;
                    case 1:
                        displayView( 1 );  // Cre_Cre
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 1) {
                switch (child_pos) {
                    case 0:
                        displayView( 2 );  // San_V
                        break;
                    case 1:
                        displayView( 3 );  // Saaa_Saaa
                        break;
                    case 2:
                        displayView( 4 );  // Eld_Eld
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 2) {
                switch (child_pos) {
                    case 0:
                        displayView( 5 );  // Monforte PLO
                        break;
                    default:
                        break;
                }
            }
            //if(grup_pos == 3) {
            //Acciones
            //}
            mDrawerLayout.closeDrawer(mDrawerExpandableList);
            return false;
        }
    });

    if (savedInstanceState == null) {
        displayView(0);
    }


// ---------1111-------------------------------------------------------------------------


    horizontal_menu = (HorizontalScrollMenuView) findViewById(R.id.horizontal_menu);
    viewPager = (ViewPager) findViewById(R.id.pager);

    horizontal_menu.addItem("Telefonos", R.drawable.menu1_icon,true);
    horizontal_menu.addItem("Navegador GPS", R.drawable.menu2_icon );
    horizontal_menu.addItem("Menu 2", R.drawable.menu3_icon );
    horizontal_menu.addItem("Menu 3", R.drawable.menu4_icon );
    horizontal_menu.addItem("Menu 4", R.drawable.menu5_icon );
    horizontal_menu.addItem("Menu 5", R.drawable.menu6_icon );
    horizontal_menu.addItem("Menu 6", R.drawable.menu7_icon );
    horizontal_menu.addItem("Menu 7", R.drawable.gps3_icon);

    horizontal_menu.showItems();


    PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(pagerAdapter);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            horizontal_menu.setItemSelected(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });

    horizontal_menu.setOnHSMenuClickListener(new HorizontalScrollMenuView.OnHSMenuClickListener() {
        @Override
        public void onHSMClick(MenuItem menuItem, int position) {
            viewPager.setCurrentItem(position);
        }
    });

}   //llave que cierra el oncreate



// -------- 2222 --------------- CODIGO PARA EL MENU LATERAL -----------------------------

private void cargarDatos() {

    grupos = new ArrayList<String>();
    datosGrupos = new HashMap<String, List<String>>();

    grupos.add("Menu Lateral 1");
    grupos.add("Menu Lateral 2");
    grupos.add("Menu Lateral 3");
    //grupos.add("Grupo 4");

    List<String> hijos_grupo1 = new ArrayList<String>();
    hijos_grupo1.add("Elc");
    hijos_grupo1.add("Cre");

    List<String> hijos_grupo2 = new ArrayList<String>();
    hijos_grupo2.add("San V.");
    hijos_grupo2.add("Saaa");
    hijos_grupo2.add("Eld");

    List<String> hijos_grupo3 = new ArrayList<String>();
    hijos_grupo3.add("Mon_PLO");

    //List<String> hijos_grupo4 = new ArrayList<String>();
    //hijos_grupo4.add("Hijo 1 de grupo 4");
    //hijos_grupo4.add("Hijo 2 de grupo 4");
    //hijos_grupo4.add("Hijo 3 de grupo 4");
    //hijos_grupo4.add("Hijo 4 de grupo 4");

    datosGrupos.put(grupos.get(0), hijos_grupo1);
    datosGrupos.put(grupos.get(1), hijos_grupo2);
    datosGrupos.put(grupos.get(2), hijos_grupo3);
    //datosGrupos.put(grupos.get(3), hijos_grupo4);

    adapter = new MyAdapter(this, grupos, datosGrupos);
    mDrawerExpandableList.setAdapter(adapter);
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void displayView(int position) {
    Fragment fragment = null;
    switch (position) {
        case 0:
            fragment = new Elc_Elc();
            break;
        case 1:
            fragment = new Cre_Cre();
            break;
        case 2:
            fragment = new SanV_SanV();
            break;
        case 3:
            fragment = new Saaa_Saaa();
            break;
        case 4:
            fragment = new Eld_Eld();
            break;
        case 5:
            fragment = new MoPLO_MoPLO();
            break;
        default:
            //fragment = new Elc_Elc();
            break;
    }

}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mDrawerToggle.syncState();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    mDrawerToggle.onConfigurationChanged(newConfig);
}


// ---------2222-------------------------------------------------------------------------


//crea el menu de opciones en el Toolbar
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_opciones, menu);
    return true;
}


@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:  
            onBackPressed();     
            return true;         

        case R.id.m_acerca:
            Toast toast = new Toast(getApplicationContext());
            toast.setGravity( Gravity.CENTER,0,0);
            TextView tv = new TextView(MainActivity.this);
            tv.setBackgroundColor( Color.RED);
            tv.setTextColor(Color.YELLOW);
            tv.setTextSize(20);
            Typeface t = Typeface.create("serif", Typeface.BOLD_ITALIC);
            tv.setTypeface(t);
            tv.setPadding(10,10,10,10);
            TextView versionname = (TextView) findViewById(R.id.ver_name);
            tv.setText("version : " + BuildConfig.VERSION_NAME);
            toast.setView(tv);
            toast.setDuration(Toast.LENGTH_LONG);
            toast.show();
            return true;

        case R.id.m_salir:
            //finish();
            onBackPressed();
    }
    return super.onOptionsItemSelected(item);
}


@Override
public void onBackPressed(){
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setIcon(R.drawable.icon_stop_1);
        builder.setMessage("Quieres salir de la aplicación?");
        builder.setTitle("Cerrar xxxx");
        builder.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        });

        AlertDialog dialog=builder.create();
        dialog.show();
    }



private class PagerAdapter extends FragmentPagerAdapter {
    PagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                return new Telefonos();
            case 1:
                return new Navegador_GPS();
            case 2:
                return new Menu_2();
            case 3:
                return new Menu_3();
            case 4:
                return new Menu_4();
            case 5:
                return new Menu_5();
            case 6:
                return new Menu_6();
            case 7:
                return new Menu_7();
            default:
                return new Telefonos();
        }
    }

    @Override
    public int getCount() {
        return 8;
    }

}

}

He probado a crear los menús por separado y cada uno funciona bien, pero a la hora de juntarlos en el MainActivity empiezan los problemas, parece que hay conflicto con en los import:

import android.app.Fragment;
import android.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.support.v4.view.PagerAdapter;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void displayView(int position) {
    Fragment fragment = null;
    switch (position) {
        case 0:
            fragment = new Elc();
            break;
        case 1:
            fragment = new Cre();
            break;
        case 2:
            fragment = new San_V();
            break;
        case 3:
            fragment = new Sa();
            break;
        case 4:
            fragment = new Eld();
            break;
        case 5:
            fragment = new Mo_PLO();
            break;
        default:
            //fragment = new Elc();
            break;
    }


    if (fragment != null) {
        //android.app.FragmentManager fragmentManager = getFragmentManager();
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction()
                .replace(R.id.frame_container, fragment).commit();

        mDrawerExpandableList.setItemChecked(position, true);
        mDrawerExpandableList.setSelection(position);
        //setTitle(grupos.get(position));
        getSupportActionBar().setTitle(mDrawerTitle);
        getSupportActionBar().setSubtitle(mTitle);
        mDrawerLayout.closeDrawer(mDrawerExpandableList);
    } else {
        Log.e("Aviso", "Error cuando se crea el fragment");
    }

}

Y éste es el código que tengo puesto para el menú horizontal del TabLayout, que al tener sus import correspondientes no muestra errores:

private class PagerAdapter extends FragmentPagerAdapter {
    PagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                return new Telefonos();
            case 1:
                return new Navegador_GPS();
            case 2:
                return new Menu_2();
            case 3:
                return new Menu_3();
            case 4:
                return new Menu_4();
            case 5:
                return new Menu_5();
            case 6:
                return new Menu_6();
            case 7:
                return new Menu_7();
            default:
                return new Telefonos();
        }
    }

    @Override
    public int getCount() {
        return 8;
    }
}

He probado a crear los menús por separado y cada uno funciona bien, pero a la hora de juntarlos en el MainActivity empiezan los problemas, parece que hay conflicto con en los import

import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.TextView;
import android.widget.Toast;

import com.SoCu.Docu_A.custom_views.HorizontalScrollMenuView;
import com.SoCu.Docu_A.extras.MenuItem;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public class MainActivity extends AppCompatActivity {

private ViewPager viewPager;
HorizontalScrollMenuView horizontal_menu;


private TextView Texto_Titulo;
private Typeface Fuente_kunstler;

private Toolbar toolbar; 
private DrawerLayout mDrawerLayout;
private ExpandableListView mDrawerExpandableList;
private ActionBarDrawerToggle mDrawerToggle;

private CharSequence mDrawerTitle;
private CharSequence mTitle;

private List<String> grupos;
private HashMap<String, List<String>> datosGrupos;
private int ultimaPosicionExpList = -1;
private MyAdapter adapter;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar); 

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setIcon(R.mipmap.ic_launcher_round);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //hacer lo que quieras
            onBackPressed();
        }
    });


// -------- 1111 --------------- CODIGO PARA EL MENU LATERAL -----------------------------


    //mDrawerTitle = getTitle();
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerExpandableList = (ExpandableListView) findViewById(R.id.explist_slidermenu);
    mDrawerExpandableList.setGroupIndicator(null);//Indicador flecha desplegable izquierda oculta

    //A continuación añadimos cabecera general...
    View header = getLayoutInflater().inflate(R.layout.cabecera_general, null);
    mDrawerExpandableList.addHeaderView(header, null, false);
    //...y pie de página
    View footer = getLayoutInflater().inflate(R.layout.pie_pagina, null);
    mDrawerExpandableList.addFooterView(footer, null, false);

    cargarDatos();


    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close) {

    };

    mDrawerToggle.setDrawerIndicatorEnabled(true); 
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mDrawerExpandableList.setTextFilterEnabled(true);
    mDrawerExpandableList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            return false;
        }
    });
    mDrawerExpandableList.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
        @Override
        public void onGroupExpand(int groupPosition) {
            if (ultimaPosicionExpList != -1 && groupPosition != ultimaPosicionExpList) {
                mDrawerExpandableList.collapseGroup(ultimaPosicionExpList);
            }
            ultimaPosicionExpList = groupPosition;
        }
    });
    mDrawerExpandableList.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
        @Override
        public void onGroupCollapse(int groupPosition) {

        }
    });

    mDrawerExpandableList.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            int grup_pos = (int)adapter.getGroupId(groupPosition);
            int child_pos = (int)adapter.getChildId(groupPosition, childPosition);
            if(grup_pos == 0) {
                switch (child_pos) {
                    case 0:

                        displayView( 0 );  //Elc_Elc

                        break;
                    case 1:
                        displayView( 1 );  // Cre_Cre
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 1) {
                switch (child_pos) {
                    case 0:
                        displayView( 2 );  // San_V
                        break;
                    case 1:
                        displayView( 3 );  // Saaa_Saaa
                        break;
                    case 2:
                        displayView( 4 );  // Eld_Eld
                        break;
                    default:
                        break;
                }
            }
            if(grup_pos == 2) {
                switch (child_pos) {
                    case 0:
                        displayView( 5 );  // Monforte PLO
                        break;
                    default:
                        break;
                }
            }
            //if(grup_pos == 3) {
            //Acciones
            //}
            mDrawerLayout.closeDrawer(mDrawerExpandableList);
            return false;
        }
    });

    if (savedInstanceState == null) {
        displayView(0);
    }


// ---------1111-------------------------------------------------------------------------


    horizontal_menu = (HorizontalScrollMenuView) findViewById(R.id.horizontal_menu);
    viewPager = (ViewPager) findViewById(R.id.pager);

    horizontal_menu.addItem("Telefonos", R.drawable.menu1_icon,true);
    horizontal_menu.addItem("Navegador GPS", R.drawable.menu2_icon );
    horizontal_menu.addItem("Menu 2", R.drawable.menu3_icon );
    horizontal_menu.addItem("Menu 3", R.drawable.menu4_icon );
    horizontal_menu.addItem("Menu 4", R.drawable.menu5_icon );
    horizontal_menu.addItem("Menu 5", R.drawable.menu6_icon );
    horizontal_menu.addItem("Menu 6", R.drawable.menu7_icon );
    horizontal_menu.addItem("Menu 7", R.drawable.gps3_icon);

    horizontal_menu.showItems();


    PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(pagerAdapter);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            horizontal_menu.setItemSelected(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });

    horizontal_menu.setOnHSMenuClickListener(new HorizontalScrollMenuView.OnHSMenuClickListener() {
        @Override
        public void onHSMClick(MenuItem menuItem, int position) {
            viewPager.setCurrentItem(position);
        }
    });

}   //llave que cierra el oncreate



// -------- 2222 --------------- CODIGO PARA EL MENU LATERAL -----------------------------

private void cargarDatos() {

    grupos = new ArrayList<String>();
    datosGrupos = new HashMap<String, List<String>>();

    grupos.add("Menu Lateral 1");
    grupos.add("Menu Lateral 2");
    grupos.add("Menu Lateral 3");
    //grupos.add("Grupo 4");

    List<String> hijos_grupo1 = new ArrayList<String>();
    hijos_grupo1.add("Elc");
    hijos_grupo1.add("Cre");

    List<String> hijos_grupo2 = new ArrayList<String>();
    hijos_grupo2.add("San V.");
    hijos_grupo2.add("Saaa");
    hijos_grupo2.add("Eld");

    List<String> hijos_grupo3 = new ArrayList<String>();
    hijos_grupo3.add("Mon_PLO");

    //List<String> hijos_grupo4 = new ArrayList<String>();
    //hijos_grupo4.add("Hijo 1 de grupo 4");
    //hijos_grupo4.add("Hijo 2 de grupo 4");
    //hijos_grupo4.add("Hijo 3 de grupo 4");
    //hijos_grupo4.add("Hijo 4 de grupo 4");

    datosGrupos.put(grupos.get(0), hijos_grupo1);
    datosGrupos.put(grupos.get(1), hijos_grupo2);
    datosGrupos.put(grupos.get(2), hijos_grupo3);
    //datosGrupos.put(grupos.get(3), hijos_grupo4);

    adapter = new MyAdapter(this, grupos, datosGrupos);
    mDrawerExpandableList.setAdapter(adapter);
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void displayView(int position) {
    Fragment fragment = null;
    switch (position) {
        case 0:
            fragment = new Elc_Elc();
            break;
        case 1:
            fragment = new Cre_Cre();
            break;
        case 2:
            fragment = new SanV_SanV();
            break;
        case 3:
            fragment = new Saaa_Saaa();
            break;
        case 4:
            fragment = new Eld_Eld();
            break;
        case 5:
            fragment = new MoPLO_MoPLO();
            break;
        default:
            //fragment = new Elc_Elc();
            break;
    }

}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mDrawerToggle.syncState();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    mDrawerToggle.onConfigurationChanged(newConfig);
}


// ---------2222-------------------------------------------------------------------------


//crea el menu de opciones en el Toolbar
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_opciones, menu);
    return true;
}


@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:  
            onBackPressed();     
            return true;         

        case R.id.m_acerca:
            Toast toast = new Toast(getApplicationContext());
            toast.setGravity( Gravity.CENTER,0,0);
            TextView tv = new TextView(MainActivity.this);
            tv.setBackgroundColor( Color.RED);
            tv.setTextColor(Color.YELLOW);
            tv.setTextSize(20);
            Typeface t = Typeface.create("serif", Typeface.BOLD_ITALIC);
            tv.setTypeface(t);
            tv.setPadding(10,10,10,10);
            TextView versionname = (TextView) findViewById(R.id.ver_name);
            tv.setText("version : " + BuildConfig.VERSION_NAME);
            toast.setView(tv);
            toast.setDuration(Toast.LENGTH_LONG);
            toast.show();
            return true;

        case R.id.m_salir:
            //finish();
            onBackPressed();
    }
    return super.onOptionsItemSelected(item);
}


@Override
public void onBackPressed(){
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setIcon(R.drawable.icon_stop_1);
        builder.setMessage("Quieres salir de la aplicación?");
        builder.setTitle("Cerrar xxxx");
        builder.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        });

        AlertDialog dialog=builder.create();
        dialog.show();
    }



private class PagerAdapter extends FragmentPagerAdapter {
    PagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                return new Telefonos();
            case 1:
                return new Navegador_GPS();
            case 2:
                return new Menu_2();
            case 3:
                return new Menu_3();
            case 4:
                return new Menu_4();
            case 5:
                return new Menu_5();
            case 6:
                return new Menu_6();
            case 7:
                return new Menu_7();
            default:
                return new Telefonos();
        }
    }

    @Override
    public int getCount() {
        return 8;
    }

}

}
se añadieron 47 caracteres en el cuerpo
Origen Enlace
SoCu
  • 468
  • 1
  • 7
  • 22

activity_main.xml <android.support.v4.widget.DrawerLayout 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" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.SoCu.CirDocu.MainActivity" tools:openDrawer="start">

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        app:titleTextColor="@android:color/white"
        app:layout_collapseMode="pin"
        android:elevation="4dp"
        app:popupTheme="@style/AppTheme.FondoMenu"
        app:theme="@style/ThemeOverlay.AppCompat.Dark"/>

    <com.SoCu.Docu_Adif.custom_views.HorizontalScrollMenuView
        android:id="@+id/horizontal_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:backgroundMenuColor="#0099cc"
    app:backgroundNotifications="@color/colorAccent"
    app:icon_height="30dp"backgroundNotifications="@color/colorAccent"
    app:icon_width="30dp"
    app:item_backgroundColor="@color/colorPrimary"icon_height="30dp"
    app:item_colorSelected="#ffffff"
    app:item_textColor="#ffffff" />


<android.support.v4.view.ViewPagericon_width="30dp"
    android:id="@+id/pager"
    androidapp:layout_width="match_parent"item_backgroundColor="@color/colorPrimary"
    android:layout_height="match_parent" />

<TextView
    androidapp:id="@+id/ver_name"item_colorSelected="#ffffff"
    android:layout_width="wrap_content"
    androidapp:layout_height="wrap_content"item_textColor="#ffffff" />
 

    <android.support.v4.widgetview.DrawerLayoutViewPager
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
layout_width="match_parent"
    <!-- Framelayout to display Fragmentsandroid:layout_height="match_parent" --/>

    <FrameLayout<TextView
        android:id="@+id/frame_container"ver_name"
        android:layout_width="match_parent"layout_width="wrap_content"
        android:layout_height="match_parent"layout_height="wrap_content" />

    </LinearLayout>

<ExpandableListView
        android:id="@+id/explist_slidermenu"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="#A4C739"
        android:background="#FFFFFF"
        android:dividerHeight="0.5dp"
        android:listSelector="#bfbfbf"
        />

</android.support.v4.widget.DrawerLayout>

activity_main.xml

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="@color/colorPrimary"
    app:titleTextColor="@android:color/white"
    app:layout_collapseMode="pin"
    android:elevation="4dp"
    app:popupTheme="@style/AppTheme.FondoMenu"
    app:theme="@style/ThemeOverlay.AppCompat.Dark"/>

<com.SoCu.Docu_Adif.custom_views.HorizontalScrollMenuView
    android:id="@+id/horizontal_menu"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:backgroundMenuColor="#0099cc"
    app:backgroundNotifications="@color/colorAccent"
    app:icon_height="30dp"
    app:icon_width="30dp"
    app:item_backgroundColor="@color/colorPrimary"
    app:item_colorSelected="#ffffff"
    app:item_textColor="#ffffff" />


<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<TextView
    android:id="@+id/ver_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
 

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Framelayout to display Fragments -->

    <FrameLayout
        android:id="@+id/frame_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <ExpandableListView
        android:id="@+id/explist_slidermenu"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="#A4C739"
        android:background="#FFFFFF"
        android:dividerHeight="0.5dp"
        android:listSelector="#bfbfbf"
        />

</android.support.v4.widget.DrawerLayout>

activity_main.xml <android.support.v4.widget.DrawerLayout 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" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.SoCu.CirDocu.MainActivity" tools:openDrawer="start">

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        app:titleTextColor="@android:color/white"
        app:layout_collapseMode="pin"
        android:elevation="4dp"
        app:popupTheme="@style/AppTheme.FondoMenu"
        app:theme="@style/ThemeOverlay.AppCompat.Dark"/>

    <com.SoCu.Docu_Adif.custom_views.HorizontalScrollMenuView
        android:id="@+id/horizontal_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:backgroundMenuColor="#0099cc"
        app:backgroundNotifications="@color/colorAccent"
        app:icon_height="30dp"
        app:icon_width="30dp"
        app:item_backgroundColor="@color/colorPrimary"
        app:item_colorSelected="#ffffff"
        app:item_textColor="#ffffff" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <TextView
        android:id="@+id/ver_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

<ExpandableListView
    android:id="@+id/explist_slidermenu"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="#A4C739"
    android:background="#FFFFFF"
    android:dividerHeight="0.5dp"
    android:listSelector="#bfbfbf"
    />

</android.support.v4.widget.DrawerLayout>
se añadieron 8084 caracteres en el cuerpo
Origen Enlace
SoCu
  • 468
  • 1
  • 7
  • 22
Loading
se eliminó 1 carácter en el cuerpo
Origen Enlace
SoCu
  • 468
  • 1
  • 7
  • 22
Loading
se añadieron 2696 caracteres en el cuerpo
Origen Enlace
SoCu
  • 468
  • 1
  • 7
  • 22
Loading
Origen Enlace
SoCu
  • 468
  • 1
  • 7
  • 22
Loading