我有一个充满 LatLng 点的列表,用于在 google maps android v2 中创建多边形,但我无法弄清楚如何将此列表正确添加到 .add 区域。这是我的清单,里面有很多要点:
list.add(new LatLng(la,lo));
Run Code Online (Sandbox Code Playgroud)
这是通过 Google Dev 生成的多边形
Polygon polygon = map.addPolygon(new PolygonOptions()
.add(*******HOW TO ITTERATE LIST************).strokeColor(Color.RED)
.fillColor(Color.BLUE));
Run Code Online (Sandbox Code Playgroud)
你是怎么加分的?
使用 ListView.separated 我们可以在列表项之间添加 Divider(),但是,一旦我转换到 SliverList,我就看不到我的分隔线。
delegate: SliverChildBuilderDelegate(
// displays the index of the current item.
(context, index) => new ListTile(
title: Text(_sagItems[index].manufacturer, style: TextStyle(fontSize: 18),),
subtitle: Text(_sagItems[index].model, style: TextStyle(fontSize: 16)),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DetailScreen(sagitem: _sagItems[index]),
),
);
},
),
//DIVIDER NOT WORKING HERE
Divider(color: Colors.blueGrey),
childCount: _sagItems.length,
),
Run Code Online (Sandbox Code Playgroud)
用 SliverList 添加分隔线的关键是什么?
除非我删除这个,否则我会收到例外:
机器人:targetSdkVersion = "15"
我在SO的另一个帖子中找到了.
但是,我已经在那里使用了targetSdkVersion运行了几天.这是我的代码:
public class MainActivity extends BaseActivity {
private TextView textView;
private String url = "http://www.backcountryskiers.com/sac/sac-full.html";
private ImageView image;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView) findViewById(R.id.todaysReport);
image = (ImageView) findViewById(R.id.dangerRose);
fetcher task = new fetcher();
task.execute();
}
public static Bitmap getBitmapFromURL(String src) {
try {
Log.e("src", src);
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
Log.e("Bitmap", "returned");
return …Run Code Online (Sandbox Code Playgroud) 我有一个Async正在运行以从我创建的页面获取数据.它得到的文本很好,但当我尝试通过另一个类从图像src获取图像时,应用程序强制关闭.以下是强制关闭的代码:
public class FullReportActivity extends NavigationActivity {
private TextView textView;
private String url = "http://www.backcountryskiers.com/sac/sac-full.html";
private ImageView ivDangerRose;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// tell which region this covers
getSupportActionBar().setSubtitle("...from Sierra Avalanche Center");
setContentView(R.layout.activity_fullreport);
textView = (TextView) findViewById(R.id.todaysReport);
ivDangerRose = (ImageView) findViewById(R.id.dangerRose);
fetcher task = new fetcher();
task.execute();
}
// GET THE IMAGE and RETURN IT
public static Bitmap getBitmapFromURL(String src) {
try {
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoInput(true);
connection.connect(); …Run Code Online (Sandbox Code Playgroud)