我想在片段中创建一些带有全局样式的文本和按钮
function Wo_FeaturedUsers($limit = '', $type = '')
{
global $wo, $sqlConnect;
if ($wo['loggedin'] == false) {
return false;
}
$data = array();
$logged_user_id = $wo['user']['user_id'];
$query_one = " SELECT `user_id` FROM `Wo_Posts` WHERE `user_id` =`user_id`";
$sql = mysqli_query($sqlConnect, $query_one);
$mysql_count = mysqli_num_rows($sql);
if ($mysql_count > 27) {
$query_one = " SELECT `user_id`, SUM(views)
FROM `Wo_Posts`
WHERE `time` >= DATE_SUB( CURRENT_DATE, INTERVAL 90
DAY ) AND page_id = 0 GROUP BY `user_id`
ORDER BY SUM(`views`) DESC LIMIT 30
";
$sql = mysqli_query($sqlConnect, $query_one);
while ($fetched_data = mysqli_fetch_assoc($sql)) {
$data[] = Wo_UserData($fetched_data['user_id']);
}
} else {
while($row = mysql_fetch_assoc($sql)) {
$sum = $row["SUM(views)"];
}
}
return $data;
}
这是样式xml
text = new TextView(this.getContext(),null, R.style.TxtLeds);
controlGrid.addView(text);
ToggleButton tb = new ToggleButton(this.getContext(), null, R.style.SwLeds);
tb.setBackgroundResource(R.drawable.sw_selector);
tb.setOnClickListener(this);
controlGrid.addView(tb);
切换创建但不是样式。它没有在中心对齐。文本已创建,但未设置“android:text” 错误是什么?