我正在创建一个带有无限滚动效果的简单列表视图.当我下载新数据时,我想在列表视图的底部显示一个不确定的进度条(如gmail app).
有2个解决方案
它会给出类似的东西
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ListView
android:id="@+id/List_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ProgressBar
android:id="@+id/trobber"
android:layout_below="@+id/List_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:indeterminate="true" >
</ProgressBar>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
但是当我的列表长度超过我的屏幕大小时(换句话说,当我必须scoll)时,不会显示进度条.
我有一个简单的 A4 pdf 文档,其属性为/Rotate 90:我的 pdf 的原始版本是横向的,但打印的是纵向。
我正在尝试在肖像文档的左下角绘制一个小图像。
\n到目前为止,这是我的代码:
\n File file = new File("rotated90.pdf");\n try (final PDDocument doc = PDDocument.load(file)) {\n PDPage page = doc.getPage(0);\n PDImageXObject image = PDImageXObject.createFromFile("image.jpg", doc);\n PDPageContentStream contents = new PDPageContentStream(doc, page, PDPageContentStream.AppendMode.APPEND, false, true);\n contents.drawImage(image, 0, 0);\n contents.close();\n doc.save(new File("newpdf.pdf"));\n}\nRun Code Online (Sandbox Code Playgroud)\n这是最终结果:如您所见,图像被放置在左上角(旋转前的 0,0 坐标)并且没有旋转。
\n\n我尝试玩drawImage(PDImageXObject image, Matrix matrix)没有成功。
这是原始文档pdf,旋转 90\xc2\xb0
\n我有一个 Kafka 主题,有 50 个分区。
我的 Spring Boot 应用程序使用 Spring Kafka 来读取这些消息@KafkaListener
我的应用程序在 Kubernetes 中自动缩放的实例数量。
默认情况下,Spring Kafka 似乎为每个主题启动 1 个消费者线程。
org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1
Run Code Online (Sandbox Code Playgroud)
因此,对于应用程序的唯一实例,一个线程正在读取 50 个分区。
有 2 个实例,有负载平衡,每个实例监听 25 个分区。每个实例仍然有 1 个线程。
concurrency我知道我可以使用上的参数设置线程数@KafkaListener。
但这是一个固定值。
有什么方法可以告诉 Spring 动态调整消费者线程的数量以适应客户端当前正在侦听的分区数量吗?
android ×1
apache-kafka ×1
draw ×1
java ×1
listview ×1
pdfbox ×1
progress-bar ×1
spring ×1
spring-kafka ×1