我正在尝试在我的应用中实现画中画模式。我正在 PIP 模式下实现谷歌地图,但我无法调整全屏地图的大小。它总是放大地图中心点。我已经完成了与此问题相关的研发,但没有找到任何正确的答案。基本上,我需要在我的应用程序上像 Whatsapp app pip Screen 这样的布局如何实现它?我的代码在这里:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Display display=getWindowManager().getDefaultDisplay();
Point size=new Point();
display.getSize(size);
int width=size.x;
int height=size.y;
Rational aspectRatio=new Rational(width,height);
PictureInPictureParams params = new PictureInPictureParams.Builder()
.setAspectRatio(aspectRatio).build();
enterPictureInPictureMode(params);
}
Run Code Online (Sandbox Code Playgroud)
这是清单代码:
<activity android:name=".activities.MainActivity"
android:supportsPictureInPicture="true"
android:resizeableActivity="true"
android:launchMode="singleTask"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"/>
Run Code Online (Sandbox Code Playgroud)
在这段代码中,我有这样的屏幕
而且我要
我该如何解决这个问题?
提前致谢!!
我正在尝试将元素列表添加到字符串列表中,但是我发现Kotlin没有像java这样的添加功能,因此请帮助我如何将项目添加到列表中。
class RetrofitKotlin : AppCompatActivity() {
var listofVechile:List<Message>?=null
var listofVechileName:List<String>?=null
var listview:ListView?=null
var progressBar:ProgressBar?=null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_retrofit_kotlin)
listview=findViewById<ListView>(R.id.mlist)
var apiInterfacee=ApiClass.client.create(ApiInterfacee::class.java)
val call=apiInterfacee.getTaxiType()
call.enqueue(object : Callback<TaxiTypeResponse> {
override fun onResponse(call: Call<TaxiTypeResponse>, response: Response<TaxiTypeResponse>) {
listofVechile=response.body()?.message!!
println("Sixze is here listofVechile ${listofVechile!!.size}")
if (listofVechile!=null) {
for (i in 0..listofVechile!!.size-1) {
//how to add the name only listofVechileName list
}
}
//println("Sixze is here ${listofVechileName!!.size}")
val arrayadapter=ArrayAdapter<String>(this@RetrofitKotlin,android.R.layout.simple_expandable_list_item_1,listofVechileName)
listview!!.adapter=arrayadapter
}
override fun onFailure(call: Call<TaxiTypeResponse>, t: Throwable) { …Run Code Online (Sandbox Code Playgroud) 我安装了新版本的Android studio Android Studio Giraffe | 2022.3.1 补丁 2。我发现变量建议不起作用。
我做了很多研发,他们建议删除 .idea 文件夹并删除
C:\Users\用户\AppData\Local\Google\AndroidStudio2022.3
。但仍没有适当的解决方案。
例子。
我添加了 Timer 类。我刚刚写了定时器。然后没有建议。
任何人对此有任何解决方案,请发布您的答案。提前致谢。