Android Open Source - ScanGoods Main Activity






From Project

Back to project page ScanGoods.

License

The source code is released under:

Apache License

If you think the Android project ScanGoods listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.munix.gridviewheader;
//from  ww  w  . j a v  a  2s  .  co m
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends Activity 
{
  private HeadGridView list;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    list = (HeadGridView)this.findViewById(R.id.list);
    list.setNumColumns(2);
    
    String strings[] = new String[100];
    for (int i = 0; i < strings.length; i++)
      strings[i] = new String("Pos " + i);
    
    View header = View.inflate( this, R.layout.item, null);
    list.addHeaderView(header);
    list.setNumColumns(2);
    
    TestAdapter adapter = new TestAdapter(this, strings);
    list.setAdapter(adapter);
    
    //Puedes dejar la cabecera fija
    //list.setFixedHeader(true);
  }
  
  public void fun( View v )
  {
    Toast.makeText(v.getContext(), "Click", Toast.LENGTH_SHORT).show();
    list.removeHeaderView();
  }
}




Java Source Code List

com.munix.gridviewheader.HeadGridView.java
com.munix.gridviewheader.MainActivity.java
com.munix.gridviewheader.TestAdapter.java
com.munix.gridviewheader.Utilities.java