无法检测.java文件中的错误

时间:2013-02-07 06:40:30

标签: android-layout

在下面的java文件中,我声明了一个imageview和TextView。

        int numRow = 6;
        int numCol = 4;

        TableLayout tblLayout = (TableLayout)findViewById(R.id.tblLayout);

        for(int i = 0; i < numRow; i++) {
            HorizontalScrollView HSV = new HorizontalScrollView(this);
            HSV.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

            TableRow tblRow = new TableRow(this);
            tblRow.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
            tblRow.setBackgroundResource(R.drawable.bookshelf);
          //  tblRow.setGravity(Gravity.CENTER | Gravity.BOTTOM);

            for(int j = 0; j < numCol; j++) {

                 ImageView imageView = new ImageView(this);
                 imageView.setImageResource(R.drawable.icon);
                 imageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));


                 TextView textView = new TextView(this);
                 textView.setText("Java Tester");
                 textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
              //   textView.setTextColor(Color.parseColor("#FFFFFF"));
                //Sultan
                tblRow.addView(imageView,j);
              //  tblRow.addView(textView,j);
            }

            HSV.addView(tblRow);
            tblLayout.addView(HSV, i);

但是文本视图的文本没有显示在屏幕上。问题是什么 ?

enter image description here

我想在TextView下面显示文本“Java Tester”。我能为此目的做些什么?

0 个答案:

没有答案