我的应用正在从Firebase检索一个长字符串,并将其显示在列表视图中,但空间不足。末尾有“ ...”,如我所附的图片所示。Heres a picture of what the listview shows
这是我的代码。我该怎么做才能使文本换行/继续到下一行?
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.ArrayList;
public class Events extends AppCompatActivity { ListView listview2;
DatabaseReference dref;
ListView listview3;
ArrayList<String> list=new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.events);
listview3=(ListView)findViewById(R.id.list_view3);
final ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,list);
listview3.setAdapter(adapter);
dref= FirebaseDatabase.getInstance().getReference("Events");
dref.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
list.add(dataSnapshot.getValue(String.class));
adapter.notifyDataSetChanged();
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
list.remove(dataSnapshot.getValue(String.class));
adapter.notifyDataSetChanged();
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
答案 0 :(得分:0)
确保在布局内添加以下属性:
const express = require('express')
const routes = require('./routes.js)
const app = express()
app.use(routes.routeOne)
app.use(routes.routeTwo)
app.listen(3000)
答案 1 :(得分:0)
由于您使用ggplot(df, aes(x=CONDITION, y=SCORE, fill=..y..)) +
geom_bar(stat="summary", fun.y="sum") +
ggtitle("Performance") +
ylab("Total") +
scale_y_continuous(labels = scales::percent) +
facet_wrap(~TASK) +
scale_fill_gradient(low="red", high="blue")
,所以只有1行文字。将其替换为simple_dropdown_item_1line