My problem lies in the following, I have 3 listview in a fragment, which runs me pretty well, the question is that when I fill the ListView
respectively, you notice that it loads everything but it does not look on my screen, a miniScroll is done in the last ListView
, I do not want it to be that way, I would like the scroll to be general and that the ListView
have the size and already. I add the code of related activities and a view.
MenuCetral.java (it's a simple navigation drawer where in the "start" section it should reflect the fragment with the listview)
public class MenuCentral extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu_central);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.contenedor,new InicioF()).commit();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_central, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
FragmentManager fragmentManager = getSupportFragmentManager();
if (id == R.id.nav_camera) {
fragmentManager.beginTransaction().replace(R.id.contenedor,new InicioF()).commit();
} else if (id == R.id.nav_gallery) {
fragmentManager.beginTransaction().replace(R.id.contenedor,new ProfesoresF()).commit();
} else if (id == R.id.nav_slideshow) {
fragmentManager.beginTransaction().replace(R.id.contenedor,new CalendarioF()).commit();
} else if (id == R.id.nav_manage) {
fragmentManager.beginTransaction().replace(R.id.contenedor,new AjustesF()).commit();
} else if (id == R.id.nav_share) {
fragmentManager.beginTransaction().replace(R.id.contenedor,new PerfilF()).commit();
} else if (id == R.id.nav_send) {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
HomeF.java (fragment that is pulling out green hairs, in this the 3 listview)
public class InicioF extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_inicio, container, false);
String[] menuDias = { "Tare",
"Trabajo",
"Salida"};
String[] menu15Das = { "Tare",
"Trabajo",
"Salida"};
String[] menumes = { "Tare",
"Trabajo",
"Salida"};
//adaptadores
//adaptador dias
ListView listdias = (ListView) view.findViewById(R.id.menudias);
ArrayAdapter<String> listavistadias = new ArrayAdapter<String>(
getActivity(),
android.R.layout.simple_list_item_1,menuDias);
listdias.setAdapter(listavistadias);
//adaptador 15dias
ListView lista15dias = (ListView) view.findViewById(R.id.menu15dias);
ArrayAdapter<String> listavista15dias = new ArrayAdapter<String>(
getActivity(),
android.R.layout.simple_list_item_1,menu15Das);
lista15dias.setAdapter(listavista15dias);
//adaptador mes
ListView listames = (ListView) view.findViewById(R.id.menumes);
ArrayAdapter<String> listavistames =new ArrayAdapter<String>(
getActivity(),
android.R.layout.simple_list_item_1,menumes);
listames.setAdapter(listavistames);
return view ;
}
}
fragment_inicio.xml (design which is linked to the HomeF.java)
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="company.viral.organizadorjec.Fragment.InicioF">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:text="Proximos Dias"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/menudias"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2">
<TextView
android:text="Proximos 15 Dias"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/menu15dias"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3">
<TextView
android:text="Proximo Mes"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/menumes"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
explanatory image
if you load the data but I can not see it because a scroll is not generated in fact, in "next 15 days" TARE comes out, and in that minimizing place a scroll is generated but for the month list it is not seen