小编Wil*_*lli的帖子

java.lang.IllegalArgumentException:android 中的宽度和高度必须 > 0

我正在尝试MultiAutoCompleteTextView从用户那里获取文本并以类似气泡的格式显示它们,但我得到:android 中的宽度和高度必须 > 0

    final MultiAutoCompleteTextView tags = (MultiAutoCompleteTextView) findViewById(R.id.multiAutoCompleteTextView1);
    String[] TAGS = getResources().getStringArray(R.array.countries);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, TAGS);
    tags.setAdapter(adapter);
    tags.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    tags.setThreshold(1);
    String contactName = tags.getText().toString();
    final SpannableStringBuilder sb = new SpannableStringBuilder();
    TextView tv = createContactTextView(contactName);
    BitmapDrawable bd = (BitmapDrawable) convertViewToDrawable(tv);
    bd.setBounds(0, 0, bd.getIntrinsicWidth(), bd.getIntrinsicHeight());

    sb.append(contactName + ",");
    sb.setSpan(new ImageSpan(bd), sb.length() - (contactName.length() + 1), sb.length() - 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    Toast.makeText(getApplicationContext(),sb,Toast.LENGTH_SHORT).show();

}

    public TextView createContactTextView(String text){
        //creating textview dynamically
        TextView tv = new TextView(this);
        tv.setText(text);
        tv.setTextSize(20); …
Run Code Online (Sandbox Code Playgroud)

java tags android multiautocompletetextview

2
推荐指数
1
解决办法
1万
查看次数

致命错误:当我尝试运行我的php时,调用非对象上的成员函数fetch_assoc()

我创建了一个包含两个表'user'和'volley'的数据库.这个PHP代码帮助我连接这些表并检索数据.

我收到这个错误

致命错误:在第11行的/home/u115908902/public_html/Wishes.php中调用非对象上的成员函数fetch_assoc()

而我试图运行我的PHP代码.

<?php 
$mysqli = NEW MySQLi("mysql.hostinger.in","willi","123","pract"); 

global $mysqli;
$resultSet = $mysqli->query("SELECT user.name AS userName,
volley.wishes AS userWishes
FROM user,volley 
WHERE user.name = 'mick' AND volley.id=user.id");

$resultSet = array();
while($rows = $resultSet->fetch_assoc()){
array_push($resultSet,
array(
$users = $rows['userName'],
$volleys = $rows['userWishes']));
echo json_encode(array("resultSet"=>$resultSet));
mysqli_close($con);
}
?>
Run Code Online (Sandbox Code Playgroud)

php database

0
推荐指数
1
解决办法
57
查看次数

标签 统计

android ×1

database ×1

java ×1

multiautocompletetextview ×1

php ×1

tags ×1