Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/214.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 按钮消失了_Android_Tablelayout - Fatal编程技术网

Android 按钮消失了

Android 按钮消失了,android,tablelayout,Android,Tablelayout,我有下一个布局(顶部:两个旋转器一半:TableLayout向下:按钮),我用WebService填充了TableLayout,其中包含。。。 “对于(int i=0;i

我有下一个布局(顶部:两个旋转器一半:TableLayout向下:按钮),我用WebService填充了TableLayout,其中包含。。。 “对于(int i=0;i 但是当WebService的最后一条记录显示在TableLayout中时,按钮消失了,怎么了

问候

//Click botton
public void consultar(View v){
    // Building Parameters to call WebService
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    String url = "http://futcho7.com.mx/MiScore/WebService/gettablapos.php";
    params.add(new BasicNameValuePair("id_cliente", numCte.get(0)));
    params.add(new BasicNameValuePair("id_sucursal", numSuc.get(0)));
    params.add(new BasicNameValuePair("id_torneo", Integer.toString(idTorneo)));
    params.add(new BasicNameValuePair("id_jornada", Integer.toString(idJornada)));

    new AsyncConector(this, url, params, this).execute();
}
//单击按钮
公众咨询员(视图五){
//构建参数以调用WebService
List params=new ArrayList();
字符串url=”http://futcho7.com.mx/MiScore/WebService/gettablapos.php";
参数add(新的BasicNameValuePair(“id_cliente”,numCte.get(0));
参数add(新的BasicNameValuePair(“id_sucursal”,numSuc.get(0));
add(新的BasicNameValuePair(“id_torneo”,Integer.toString(idTorneo));
add(新的BasicNameValuePair(“id_jornada”,Integer.toString(idJornada));
新的AsyncConctor(this,url,params,this).execute();
}
方法填充TableLayOut

public void showTablaPos(){
    TableLayout tablaPos = (TableLayout) findViewById(R.id.tabla_pos);
    //Create table row header 
    TableRow tr_head = new TableRow(this);
    tr_head.setId(10);
    tr_head.setBackgroundColor(Color.GRAY);
    //tr_head.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
    //Se crean los header
    TextView label_equipo = new TextView(this);
    label_equipo.setId(20);
    label_equipo.setText("EQUIPO");
    label_equipo.setTextColor(Color.WHITE);
    label_equipo.setPadding(5, 5, 5, 5);
    tr_head.addView(label_equipo);

    TextView label_jj = new TextView(this);
    label_jj.setId(20);
    label_jj.setText("JJ");
    label_jj.setTextColor(Color.WHITE);
    label_jj.setPadding(5, 5, 5, 5);
    tr_head.addView(label_jj);

    TextView label_jg = new TextView(this);
    label_jg.setId(20);
    label_jg.setText("JG");
    label_jg.setTextColor(Color.WHITE);
    label_jg.setPadding(5, 5, 5, 5);
    tr_head.addView(label_jg);

    TextView label_je = new TextView(this);
    label_je.setId(20);
    label_je.setText("JE");
    label_je.setTextColor(Color.WHITE);
    label_je.setPadding(5, 5, 5, 5);
    tr_head.addView(label_je);

    TextView label_jp = new TextView(this);
    label_jp.setId(20);
    label_jp.setText("JP");
    label_jp.setTextColor(Color.WHITE);
    label_jp.setPadding(5, 5, 5, 5);
    tr_head.addView(label_jp);

    TextView label_gf = new TextView(this);
    label_gf.setId(20);
    label_gf.setText("GF");
    label_gf.setTextColor(Color.WHITE);
    label_gf.setPadding(5, 5, 5, 5);
    tr_head.addView(label_gf);

    TextView label_ge = new TextView(this);
    label_ge.setId(20);
    label_ge.setText("GE");
    label_ge.setTextColor(Color.WHITE);
    label_ge.setPadding(5, 5, 5, 5);
    tr_head.addView(label_ge);

    TextView label_dif = new TextView(this);
    label_dif.setId(20);
    label_dif.setText("DIF");
    label_dif.setTextColor(Color.WHITE);
    label_dif.setPadding(5, 5, 5, 5);
    tr_head.addView(label_dif);

    TextView label_ptos = new TextView(this);
    label_ptos.setId(20);
    label_ptos.setText("PTOS.");
    label_ptos.setTextColor(Color.WHITE);
    label_ptos.setPadding(5, 5, 5, 5);
    tr_head.addView(label_ptos);

    tablaPos.addView(tr_head, new TableLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT));
    Integer count = 0;
    Integer cuantos = ljsonArray.length();
    try{
        for (int i = 0; i < ljsonArray.length(); i++) {
            ljsonObject = ljsonArray.getJSONObject(i);                  

            String equipo = (ljsonObject.optString("equ_nombre"));
            Integer jj = (ljsonObject.optInt("jj"));
            Integer jg = (ljsonObject.optInt("jg"));
            Integer je = (ljsonObject.optInt("je"));
            Integer jp = (ljsonObject.optInt("jp"));
            Integer gf = (ljsonObject.optInt("gf"));
            Integer ge = (ljsonObject.optInt("ge"));
            Integer dif = (ljsonObject.optInt("dif"));
            Integer pto = (ljsonObject.optInt("puntos"));

            TableRow tr = new TableRow(this);
            if(count%2!=0) tr.setBackgroundColor(Color.GRAY);
            tr.setId(100+count);
            //tr.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));

            //Create columns to add as table data
            // Create a TextView to add equipo

            TextView labelEquipo = new TextView(this);
            labelEquipo.setId(200+count); 
            labelEquipo.setText(equipo);
            labelEquipo.setPadding(2, 0, 5, 0);
            labelEquipo.setTextColor(Color.WHITE);
            tr.addView(labelEquipo);

            TextView labelJj = new TextView(this);
            labelJj.setId(200+count); 
            labelJj.setText(Integer.toString(jj));
            labelJj.setPadding(2, 0, 5, 0);
            labelJj.setTextColor(Color.WHITE);
            labelJj.setGravity(Gravity.CENTER);
            tr.addView(labelJj);

            TextView labelJg = new TextView(this);
            labelJg.setId(200+count); 
            labelJg.setText(Integer.toString(jg));
            labelJg.setPadding(2, 0, 5, 0);
            labelJg.setTextColor(Color.WHITE);
            labelJg.setGravity(Gravity.CENTER);
            tr.addView(labelJg);

            TextView labelJe = new TextView(this);
            labelJe.setId(200+count); 
            labelJe.setText(Integer.toString(je));
            labelJe.setPadding(2, 0, 5, 0);
            labelJe.setTextColor(Color.WHITE);
            labelJe.setGravity(Gravity.CENTER);
            tr.addView(labelJe);

            TextView labelJp = new TextView(this);
            labelJp.setId(200+count); 
            labelJp.setText(Integer.toString(jp));
            labelJp.setPadding(2, 0, 5, 0);
            labelJp.setTextColor(Color.WHITE);
            labelJp.setGravity(Gravity.CENTER);
            tr.addView(labelJp);

            TextView labelGf = new TextView(this);
            labelGf.setId(200+count); 
            labelGf.setText(Integer.toString(gf));
            labelGf.setPadding(2, 0, 5, 0);
            labelGf.setTextColor(Color.WHITE);
            labelGf.setGravity(Gravity.CENTER);
            tr.addView(labelGf);

            TextView labelGe = new TextView(this);
            labelGe.setId(200+count); 
            labelGe.setText(Integer.toString(ge));
            labelGe.setPadding(2, 0, 5, 0);
            labelGe.setTextColor(Color.WHITE);
            labelGe.setGravity(Gravity.CENTER);
            tr.addView(labelGe);

            TextView labelDif = new TextView(this);
            labelDif.setId(200+count); 
            labelDif.setText(Integer.toString(dif));
            labelDif.setPadding(2, 0, 5, 0);
            labelDif.setTextColor(Color.WHITE);
            labelDif.setGravity(Gravity.CENTER);
            tr.addView(labelDif);

            TextView labelPtos = new TextView(this);
            labelPtos.setId(200+count); 
            labelPtos.setText(Integer.toString(pto));
            labelPtos.setPadding(2, 0, 5, 0);
            labelPtos.setTextColor(Color.WHITE);
            labelPtos.setGravity(Gravity.CENTER);

            tr.addView(labelPtos);

            // finally add this to the table row
            tablaPos.addView(tr, new TableLayout.LayoutParams(
                                    LayoutParams.WRAP_CONTENT,
                                    LayoutParams.WRAP_CONTENT));
            count++;


        }
        } catch (Exception e) {
            Log.e("Error", e.getMessage());
            e.printStackTrace();
        }
}
public void showtableapos(){
TableLayout tablaPos=(TableLayout)findviewbyd(R.id.tabla_pos);
//创建表格行标题
TableRow tr_head=新TableRow(本);
tru头setId(10);
tr_头.立根基色(颜色.灰色);
//tr_head.setLayoutParams(新的LayoutParams(LayoutParams.MATCH_父级,LayoutParams.MATCH_父级));
//东南克伦洛斯头球
TextView标签=新的TextView(本);
标签设备设置ID(20);
标签_equipo.setText(“equipo”);
标签设备设置颜色(颜色为白色);
标签设备设置填充(5,5,5,5);
tr_head.addView(标签设备);
TextView标签_jj=新的TextView(本);
标签_jj.setId(20);
label_jj.setText(“jj”);
标签颜色(颜色:白色);
标签设置填充(5,5,5,5);
tr_head.addView(标签jj);
TextView标签_jg=新的TextView(本);
标签(20);
标签_jg.setText(“jg”);
标签颜色(颜色为白色);
标签(5,5,5,5);
tr_head.addView(标签_jg);
TextView标签_je=新的TextView(本);
标签(20);;
标签_je.setText(“je”);
标签颜色(白色);
标签(5,5,5,5);
tr_head.addView(标签_-je);
TextView label_jp=新的TextView(此);
label_jp.setId(20);
label_jp.setText(“jp”);
label_jp.setTextColor(Color.WHITE);
标签(5,5,5,5);
tr_head.addView(label_jp);
TextView标签\u gf=新的TextView(此);
标签(20);
标签_gf.setText(“gf”);
标签颜色(颜色为白色);
标签(5,5,5,5);
tr_head.addView(标签_gf);
TextView标签=新的TextView(本);
标签设置ID(20);
标签_ge.setText(“ge”);
标签颜色(颜色为白色);
标签设置填充(5,5,5,5);
tr_head.addView(标签);
TextView label_dif=新的TextView(此);
标签设置ID(20);
标签_dif.setText(“dif”);
标签颜色(颜色为白色);
设置填充的标签(5,5,5,5);
tr_head.addView(标签dif);
TextView标签\u ptos=新的TextView(本);
标签设置ID(20);
标签_ptos.setText(“ptos”);
标签颜色(颜色:白色);
标签设置填充(5,5,5,5);
tr_head.addView(标签);
tablaPos.addView(tr_头,新的TableLayout.LayoutParams(
LayoutParams.WRAP_内容,
LayoutParams.WRAP_内容);
整数计数=0;
整数cuantos=ljsonArray.length();
试一试{
for(int i=0;i<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/verde"
android:orientation="vertical" >

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

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_weight="1.14"
        android:text="@string/tit_torneo"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/blanco"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_weight="0.10"
        android:text="@string/tit_jornada"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/blanco"
        android:textStyle="bold" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <Spinner
        android:id="@+id/torneo"
        android:layout_width="202dp"
        android:layout_height="wrap_content"
        android:prompt="@string/spinner_prompt_torneo" />

    <Spinner
        android:id="@+id/jornada"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.98" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_gravity="bottom"
    android:layout_weight="1"
    android:orientation="horizontal" >


    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scrollbars="vertical">

        <TableLayout
            android:id="@+id/tabla_pos"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:stretchColumns="0,1" >

        </TableLayout>
    </ScrollView>

    <Button
        android:id="@+id/consulta"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@color/blanco"
        android:onClick="consultar"
        android:text="Consultar"
        android:textColor="@color/negro"
        android:textStyle="bold" />

</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical" >

    <LinearLayout
        android:background="@color/verde"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_weight="1.14"
            android:text="@string/tit_torneo"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/blanco"
            android:textStyle="bold" />

       <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_weight="0.10"
            android:text="@string/tit_jornada"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/blanco"
            android:textStyle="bold" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <Spinner
            android:id="@+id/torneo"
            android:layout_width="202dp"
            android:layout_height="wrap_content"
            android:prompt="@string/spinner_prompt_torneo" />

        <Spinner
            android:id="@+id/jornada"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.98" />

     </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:orientation="horizontal" >


        <ScrollView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scrollbars="vertical">

            <TableLayout
                android:id="@+id/tabla_pos"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:stretchColumns="0,1" >

            </TableLayout>
        </ScrollView>


    </LinearLayout>

    </LinearLayout>

    <Button
        android:id="@+id/consulta"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@color/blanco"
        android:onClick="consultar"
        android:text="Consultar"
        android:textColor="@color/negro"
        android:textStyle="bold"
        android:layout_alignParentBottom="true"/>

</RelativeLayout>