小编Kis*_*ama的帖子

flutter 使用 getx 传递多个数据

我想使用 Get 包将多个数据从一个屏幕传递到另一个屏幕。

Get.to(Second(), arguments: ["First data", "Second data"]);
Run Code Online (Sandbox Code Playgroud)

arguments get send flutter flutter-getx

27
推荐指数
3
解决办法
7万
查看次数

RecyclerView滞后滚动

我在RecyclerView中加载400x200图像,但在2k设备上滚动是滞后的.我正在使用Picasso从资源加载图像.

正如您在演示图像中看到的那样,在2k屏幕上模糊,但如果我加载更高分辨率的图像,情况会变得更糟.如何解决这个问题,我甚至没有加载大图像,它的400x200?

演示

这是我的代码 card_view.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/card_view"
    card_view:cardPreventCornerOverlap="false"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_margin="8dp"
    card_view:cardCornerRadius="2dp">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/rel">

        <ImageView
            android:id="@+id/cardimage"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="fitXY"
            android:src="@drawable/p7"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="title"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:paddingTop="16dp"
            android:paddingBottom="24dp"
            android:textStyle="bold"
            android:textSize="24sp"
            android:id="@+id/cardtitle"
            android:layout_gravity="center_vertical"/>

    </LinearLayout>

</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)

Myadapter代码

public class CardAdapter extends RecyclerView.Adapter<CardAdapter.ViewHolder> {

private Context mContext;
List<Flower> list = new ArrayList<>();

public CardAdapter(Context mContext, List<Flower> list) {
    this.mContext = mContext;
    this.list = list;

}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)   {

    View itemView …
Run Code Online (Sandbox Code Playgroud)

android picasso android-recyclerview

19
推荐指数
4
解决办法
3万
查看次数

Android:Google地图无法显示

我正在尝试显示谷歌地图.我可以看到背景(浅灰色背景,小瓷砖,左下角的Google徽标),所以我知道我很接近.但是,没有显示实际地图.在LogCat中,我看到这条消息一遍又一遍地重复:

05-14 13:28:17.926:W/System.err(27458):at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher $ DispatcherServer.run(DataRequestDispatcher.java:1702)

我正在使用带有系留手机的谷歌地图api 2进行测试,运行2.3.4.

有谁知道这可能导致什么?谢谢!

package com.example.maptest;
import android.os.Bundle;
import com.google.android.maps.MapActivity; 
import com.google.android.maps.MapController; 
import com.google.android.maps.MapView;

public class MyMapActivity extends MapActivity {   

  private MapView mapView;   
  private MapController mapController;

   @Override   public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.map_layout);
     mapView = (MapView)findViewById(R.id.map_view);
   }

   @Override   
   protected boolean isRouteDisplayed() {
     return false;   
   }

 }
Run Code Online (Sandbox Code Playgroud)

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.maptest"
    android:versionCode="1"
    android:versionName="1.0" >

    <permission android:name="com.example.maptest.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="com.example.maptest.permission.MAPS_RECEIVE"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> …
Run Code Online (Sandbox Code Playgroud)

android google-maps-android-api-2

10
推荐指数
1
解决办法
6万
查看次数

通过strings.xml在app中更改语言

我是java的新手,实际上正在开发一个游戏应用程序,我想添加一个可以改变游戏语言的功能.

我已经制作了2个strings.xml.一个是默认(英文),另一个是翻译版本(fil)

这是我的代码

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class LanguageActivity extends Activity {
  private static Button button_fil;
  private static Button button_eng;

  public void onButtonClickListener() {
    button_fil = (Button) findViewById(R.id.btnFilipino);
    button_fil.setOnClickListener(
      new View.OnClickListener() {@
        Override
        public void onClick(View v) {
          Toast.makeText(LanguageActivity.this, "Filipino Language", Toast.LENGTH_SHORT).show();
        }
      }
    );

    button_eng = (Button) findViewById(R.id.btnEnglish);
    button_eng.setOnClickListener(
      new View.OnClickListener() {@
        Override
        public void onClick(View v) {
          Toast.makeText(LanguageActivity.this, "English Language", Toast.LENGTH_SHORT).show();
        }
      }
    );

  }


  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState); …
Run Code Online (Sandbox Code Playgroud)

java xml string android

8
推荐指数
3
解决办法
2万
查看次数

具有定期请求的工作管理器多次调用

我正在使用工作经理进行定期任务.我要执行单个工作实例

我的代码如下

  val workManager = WorkManager.getInstance()
  val callDataRequest = PeriodicWorkRequest.Builder(MyLoggerWork::class.java,
                15, TimeUnit.MINUTES)
                .addTag(worker)
                .build()
   workManager.enqueueUniquePeriodicWork(worker, ExistingPeriodicWorkPolicy.KEEP, callDataRequest)
Run Code Online (Sandbox Code Playgroud)

我的工作人员记录如下

18/09/2018 03:18:19
18/09/2018 03:18:19
18/09/2018 03:18:19
18/09/2018 03:18:19

18/09/2018 03:37:18
18/09/2018 03:37:18
18/09/2018 03:37:18
18/09/2018 03:37:18
Run Code Online (Sandbox Code Playgroud)

这是我的MyLoggerWork类

public class MyLoggerWork: Worker(){


override fun doWork(): Result {
    addlog()
    return Worker.Result.SUCCESS
}

private fun addlog() {

    try {

        val directory = File(Environment.getExternalStorageDirectory().path + "/", "Jobs")
        if (!directory.exists()) {
            directory.mkdir()
        }
        val file = File(directory.path, "jobs_.txt")
        if (!file.exists() && directory.exists()) {
            file.createNewFile()
        }
        try { …
Run Code Online (Sandbox Code Playgroud)

android kotlin android-workmanager

8
推荐指数
1
解决办法
1184
查看次数

Android 给视频添加水印

我使用grafika项目制作视频录制应用程序。现在我想为视频添加水印。(我有视频的文件路径)。请有人帮助提供任何代码片段或建议。是的,除非没有其他解决方案,否则我不想像重型库一样使用 ffmpeg

存在此类类似问题,但没有找到任何解决方案。这里发布了一个解决方案,但不清楚具体如何进行:https : //stackoverflow.com/a/43231245/7026525任何帮助表示赞赏。

android video-processing

7
推荐指数
0
解决办法
3760
查看次数

错误MSB4044:"AdjustJavacVersionArguments"任务未获得所需参数"JdkVersion"的值

我正在尝试运行一个Android应用程序抛出Visual Studio(7.4 Build 1033),似乎我遇到了这个问题:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2):错误MSB4044:"AdjustJavacVersionArguments"任务未获得所需参数"JdkVersion"的值.(MSB4044)

而且......我不知道如何解决这个问题......

我看到Visual Studio有正确的JDK路径(在UI中提到"Found"),JDK的版本也是1.8.

任何帮助我的提示?

android xamarin

6
推荐指数
1
解决办法
1762
查看次数

Data Binding inflation is very slow

I'm currently using DataBinding with a RecyclerView, and I'm getting pretty severe lag when a list first loads. However, after I scroll past a page and it stops creating new viewholders, everything is fine.

During creation, the only thing I'm doing is inflating a layout using DataBindingUtils, so I'm wondering if there are parts that can be improved.

Attached below are relevant code snippets. I'm currently using a library, FastAdapter, so the signatures will not match exactly

When …

android kotlin android-recyclerview android-databinding

6
推荐指数
1
解决办法
1886
查看次数

Android Compose Textfield 句柄退格键(删除)

撰写中是否有任何方法可以处理键盘中的删除(退格)操作?我想处理键盘中的删除操作

android android-jetpack-compose

5
推荐指数
1
解决办法
2098
查看次数

错误:在项目“应用程序”中,已解决的 Google Play 服务库依赖项依赖于另一个准确版本

当我尝试编译我的项目时,我遇到了以下错误

错误:在项目“应用程序”中,已解析的 Google Play 服务库依赖项依赖于另一个确切版本(例如“[15.0.1]”,但未解析为该版本。库表现出的行为将是未知的。

build.gradle(应用程序)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.spars.myapplication"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    mavenCentral()
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.razorpay:checkout:1.4.5'
    implementation 'com.google.firebase:firebase-database:16.0.6'
    implementation 'com.firebaseui:firebase-ui:3.3.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    testImplementation 'junit:junit:4.12'
    //add start
    implementation "android.arch.lifecycle:extensions:1.1.1"
// …
Run Code Online (Sandbox Code Playgroud)

android build.gradle android-gradle-plugin

4
推荐指数
1
解决办法
8269
查看次数