| | Major Heading 1 | Major Heading 2 |
| Minor1 | Minor2 | Minor3 | Minor4 | Minor5 |
| ----------------------------------------------
| col1 | col2 | col3 | col4 | col5 |
以上是我的表格的样子。现在col2& COL3 col4&是相同的因此,我需要col3和amp;之间的界限。 4 大胆。
echo "<table border='1' id = 'frmnew' cellpadding='10'>";
echo "<tr>
<th rowspan='2'><center><b>Part Number</b></center></th>
<th rowspan='2'><center><b>Minimum Quantity</b></center></th>
<th rowspan='2'><center><b>Maximum Quantity</b></center></th>
<th colspan='4' scope='colgroup'><center>SHIP AGAINST PO</center></th>
<th colspan='4' scope='colgroup'><center>FORECAST FROM VARIOUS REGIONS PENDING FOR INTERCO PO</center></th>
</tr>
<tr>
<th scope='col'><center>UK</center></th>
<th scope='col'><center>US</center></th>
<th scope='col'><center>ASIA</center></th>
<th scope='col'><center>MEXICO</center></th>
<th scope='col'><center>UK</center></th>
<th scope='col'><center>US</center></th>
<th scope='col'><center>ASIA</center></th>
<th scope='col'><center>MEXICO</center></th>
</tr>";
这些是代码。同样的路线会令人困惑。另外,我需要从表格的顶部到结尾加粗。有人可以帮忙吗?
答案 0 :(得分:0)
请试试这个
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
progressDialog.dismiss();
try {
JSONObject jsonObject = new JSONObject(response);
JSONArray jsonArray = jsonObject.getJSONArray("list");
tv.removeAllViewsInLayout();
int flag = 1;
for (int i =-1 ; i < jsonArray.length();i++) {
TableRow tr = new TableRow(TestDetails.this);
tr.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
if (flag == 1) {
TextView b10 = new TextView(TestDetails.this);
b10.setPadding(50, 30, 50, 30);
b10.setText("ID");
b10.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
b10.setTop(20);
b10.setTextColor(Color.BLACK);
b10.setBackgroundColor(Color.rgb(206, 147, 216));
b10.setTextSize(15);
tr.addView(b10);
TextView b6 = new TextView(TestDetails.this);
b6.setPadding(50, 30, 50, 30);
b6.setText("TEST CODE");
b6.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
b6.setTop(20);
b6.setTextColor(Color.BLACK);
b6.setBackgroundColor(Color.rgb(206, 147, 216));
b6.setTextSize(15);
tr.addView(b6);
TextView b19 = new TextView(TestDetails.this);
b19.setPadding(50, 30, 50, 30);
b19.setTextSize(15);
b19.setText("TEST DESCRIPTION");
b19.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
b19.setTextColor(Color.BLACK);
b19.setBackgroundColor(Color.rgb(206, 147, 216));
tr.addView(b19);
TextView b29 = new TextView(TestDetails.this);
b29.setPadding(10, 0, 0, 0);
b29.setText("TEST PRICE");
b29.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
b29.setTextColor(Color.rgb(104, 143, 202));
b29.setTextSize(15);
tr.addView(b29);
tv.addView(tr);
final View vline = new View(TestDetails.this);
vline.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, 10));
vline.setBackgroundColor(Color.BLUE);
tv.addView(vline);
flag = 0;
} else {
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
String n = jsonObject1.getString("test_code");
TextView b6 = new TextView(TestDetails.this);
b6.setText(n);
b6.setPadding(50, 30, 50, 30);
b6.setTextColor(Color.BLACK);
b6.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
b6.setTextSize(15);
tr.addView(b6);
TextView b1 = new TextView(TestDetails.this);
b1.setPadding(50, 30, 50, 30);
b1.setTextSize(15);
String stime1 = jsonObject1.getString("test_description");
b1.setText(stime1);
b1.setTextColor(Color.BLACK);
// b1.setBackgroundColor(Color.rgb(186, 104, 200));
b1.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
tr.addView(b1);
TextView b2 = new TextView(TestDetails.this);
b2.setPadding(10, 30, 110, 30);
String stime2 = jsonObject1.getString("test_price");
b2.setText(stime2);
b2.setTextColor(Color.BLACK);
b2.setBackgroundColor(Color.rgb(144, 202, 249));
b2.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
b2.setTextSize(15);
tr.addView(b2);
tv.addView(tr);
final View vline1 = new View(TestDetails.this);
vline1.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, 1));
vline1.setBackgroundColor(Color.rgb(1, 132, 143));
tv.addView(vline1);
}
}
} catch (JSONException e) {
progressDialog.dismiss();
Toast.makeText(getApplicationContext(),"Unable to display data. Check internet connection",Toast.LENGTH_LONG);
Log.e("Error", "Failed" +e.toString());
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
progressDialog.dismiss();
Toast.makeText(getApplicationContext(),"Unable to display data. Check internet connection", Toast.LENGTH_LONG);
Log.e("Error", "Try Later" +error.toString());
}
});
RequestQueue requestQueue = Volley.newRequestQueue(TestDetails.this);
requestQueue.add(stringRequest);
答案 1 :(得分:0)
要在表格中加粗某些行,您可以为每个列添加边框样式。
将echo "<table border='1' id = 'frmnew' cellpadding='10'>";
echo "<tr>
<th rowspan='2'><center><b>Part Number</b></center></th>
<th rowspan='2'><center><b>Minimum Quantity</b></center></th>
<th rowspan='2'><center><b>Maximum Quantity</b></center></th>
<th colspan='4' scope='colgroup' style='border-right:none;'><center>SHIP AGAINST PO</center></th>
<th colspan='4' scope='colgroup' style='border-left: 5px solid black;'><center>FORECAST FROM VARIOUS REGIONS PENDING FOR INTERCO PO</center></th>
</tr>
<tr>
<th scope='col'><center>UK</center></th>
<th scope='col'><center>US</center></th>
<th scope='col'><center>ASIA</center></th>
<th scope='col' style='border-right:none;'><center>MEXICO</center></th>
<th scope='col' style='border-left: 5px solid black;'><center>UK</center></th>
<th scope='col'><center>US</center></th>
<th scope='col'><center>ASIA</center></th>
<th scope='col'><center>MEXICO</center></th>
</tr>";
echo "</table>";
添加到第3列应该可以解决问题
您当然也可以在第4列中执行此操作,您可以在其中说border-right-style: solid;
建议您将右边框设置为无,如果您想要向左边添加边框,而在课程border-left-style: solid;