下面是我写的xml文件。我在外侧和两排之间有一个边界。我不知道如何将边界划分为两列,例如将两个文本视图分开。
<?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:id="@+id/relative"
android:layout_marginBottom="8dp"
android:backgroundTint="#111"
android:fadeScrollbars="true">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#111"
android:showDividers="middle"
android:stretchColumns="*"
android:background="@drawable/cell_shape"
>
<TableRow android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_margin="2dip"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/TeamAB"
android:layout_marginTop="33dp"
android:layout_marginLeft="25dp"
android:layout_weight="1"
android:textAlignment="center"
android:textColor="#111"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/teamBA"
android:layout_marginTop="33dp"
android:layout_weight="1"
android:layout_marginRight="25dp"
android:textAlignment="center"
android:textColor="#111"
/>
</TableRow>
<TableRow
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@drawable/cell_shape">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/scoreAB"
android:textColor="#111"
android:layout_weight="1"
android:layout_marginTop="32dp"
android:layout_marginLeft="15dp"
android:textAlignment="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/scoreBA"
android:layout_weight="1"
android:layout_marginTop="32dp"
android:layout_marginRight="15dp"
android:textAlignment="center"
android:textColor="#111"
/>
</TableRow>
</TableLayout>
</RelativeLayout>
cell_shape.xml文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape= "rectangle" >
<solid android:color="#0fff"/>
<stroke android:width="2dp" android:color="#000"/>
<corners android:radius="10dp"></corners>
</shape>
尝试使用android:divider和android:show dividers,它不起作用。
编辑 - 代码中也会感谢任何更改,以获得所需的结果!
答案 0 :(得分:0)
试试这个例子
<?php
define ("DB_HOST", "localhost");
define ("DB_USER", "root");
define ("DB_PASS","");
define ("DB_NAME","yukti");
error_reporting(0);
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
$db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");
$setCounter = 0;
$setExcelName = "download_excal_file";
$setSql = "SELECT * FROM login ORDER BY id ASC";
$setRec = mysql_query($setSql);
$setCounter = mysql_num_fields($setRec);
for ($i = 0; $i < $setCounter; $i++) {
$setMainHeader .= mysql_field_name($setRec, $i)."\t";
}
while($rec = mysql_fetch_row($setRec)) {
$rowLine = '';
foreach($rec as $value) {
if(!isset($value) || $value == "") {
$value = "\t";
} else {
//It escape all the special charactor, quotes from the data.
$value = strip_tags(str_replace('"', '""', $value));
$value = '"' . $value . '"' . "\t";
}
$rowLine .= $value;
}
$setData .= trim($rowLine)."\n";
}
$setData = str_replace("\r", "", $setData);
if ($setData == "") {
$setData = "\nno matching records found\n";
}
$setCounter = mysql_num_fields($setRec);
//This Header is used to make data download instead of display the data
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$setExcelName."_Reoprt.xls");
header("Pragma: no-cache");
header("Expires: 0");
//It will print all the Table row as Excel file row with selected column name as header.
echo ucwords($setMainHeader)."\n".$setData."\n";
?>