以下代码将 text 和小部件保存在一行中,但是,想知道更好方法的可能性,如果有的话。此外,如您所见,小部件未正确对齐;虽然它在RStudio观众看起来很不错
这是图像
这是可重现的代码
Context context;
int httpCacheSize = 100 * 1024 * 1024; // 100mb
File httpCacheDir = new File(context.getCacheDir(), "http");
Cache cache = new Cache(httpCacheDir, httpCacheSize);
OkHttpClient client = new OkHttpClient.Builder()
.cache(cache)
.readTimeout(WebServicesManager.READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
.connectTimeout(WebServicesManager.CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
.build();
Request request = new Request.Builder()
.url(downloadUrl)
.get()
.build();
Response response = null;
try {
response = client.newCall(request).execute();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (response != null) {
response.close();
}
if (!cache.isClosed()) {
try {
cache.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}