小编Ani*_*nil的帖子

Kotlin parcelable和arrayList of parcelables

我试图写一个parcelable数据对象从传递到activityAactivityB在我的Android应用程序.

我的对象是传递所有数据,除了我arraylist的可用服务类

data class AvailableService(val id: Int,
                        val name: String,
                        val description: String,
                        val price: Double,
                        val currency: String,
                        val imageUrl: String) : Parcelable {

companion object {
    @JvmField @Suppress("unused")
    val CREATOR = createParcel { AvailableService(it) }
}

protected constructor(parcelIn: Parcel) : this(parcelIn.readInt(),
        parcelIn.readString(),
        parcelIn.readString(),
        parcelIn.readDouble(),
        parcelIn.readString(),
        parcelIn.readString())

override fun writeToParcel(dest: Parcel?, flags: Int) {
    dest?.writeInt(id)
    dest?.writeString(name)
    dest?.writeString(description)
    dest?.writeDouble(price)
    dest?.writeString(currency)
    dest?.writeString(imageUrl)
}

override fun describeContents() = 0
}
Run Code Online (Sandbox Code Playgroud)

上面是可用的serviceClass,接下来我有旅行,其持有arraylistAvailableService …

android parcelable kotlin

17
推荐指数
3
解决办法
1万
查看次数

Android模拟器崩溃与运行时错误r6025纯虚函数调用

我的Android模拟器正在关闭此错误消息

运行时错误r6025纯虚函数调用

它经常发生,我该怎么做才能克服这个错误.对此的任何帮助都是赞赏的.

sdk android android-emulator r6025

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

导航栏按钮颜色

我想在应用程序中更改导航按钮的颜色, 在此处输入图片说明

我尝试过,window.setNavigationBarColor(@ColorInt int color)但是这种方法只改变酒吧的背景。有任何想法吗?

layout android uinavigationbar galaxy

7
推荐指数
1
解决办法
4330
查看次数

Android - 在 api 级别 19 之前评估javascript

evaluatejavascript可用于 API 级别 19 及更高版本。它有一个回调。我知道我可以在 API 级别 19 之前使用loadUrl代替evaluatejavascriptfor。但是我如何处理脚本的返回值?有解决方案吗?

String script = "function(){ return "abc"}()";
mywebview.loadUrl(script);
Run Code Online (Sandbox Code Playgroud)

javascript android webview android-api-levels

7
推荐指数
1
解决办法
573
查看次数

从 textview 中的可点击电子邮件中删除下划线

我正在开发一个 android 应用程序,在该应用程序中我已将邮件放入文本中textView并且可以点击。我想从邮件中删除下划线。怎么做?

 <TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textSize="@dimen/mailnlink"
    android:textColor="@color/mltext"
    android:textColorLink="@color/link"
    android:textStyle="italic"
    android:gravity="center"
    android:autoLink="email"
    android:background="@color/mlb"
    android:text="@string/f2"/>
Run Code Online (Sandbox Code Playgroud)

android

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

自动填充功能不适用于AppCompatEditText

我为Android O支持准备我的应用程序,并希望自动填充正常工作.我在系统设置中选择了Google自动填充服务,添加了自动填充的特殊提示.

我已登录dialog延伸DialogFragment.正如在Android开发人员中所写,我不需要任何动作来进行自动填充工作,除了布局" android:autofillHints"和" android:importantForAutofill" 之外,它将自动工作.

但自动填充功能不起作用.

对话框布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/layout_login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:importantForAutofill="yes"
        android:orientation="vertical"
        android:paddingBottom="15dp"
        android:paddingLeft="21dp"
        android:paddingRight="21dp"
        android:paddingTop="20dp">

        <TextView
            style="@style/LoginDialogTextTitle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/button.text.enter" />

        <com.myapp.android.views.widgets.TextInputLayout
            android:id="@+id/layout_text_email"
            android:layout_width="match_parent"
            android:layout_height="59dp"
            android:layout_marginTop="14dp"
            android:hint="@string/label.email"

            app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/text_email"
                style="@style/EditText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:autofillHints="emailAddress"
                android:inputType="textEmailAddress"
                app:backgroundTint="@color/_gray_text"
                app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout" />
        </com.myapp.android.views.widgets.TextInputLayout>

        <RelativeLayout
            style="@style/EditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.myapp.android.views.widgets.TextInputLayout
                android:id="@+id/layout_text_password"
                android:layout_width="match_parent"
                android:layout_height="59dp"
                android:hint="@string/hint.password"
                app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"
                app:passwordToggleEnabled="false">

                <android.support.v7.widget.AppCompatEditText
                    android:id="@+id/text_password"
                    style="@style/EditText"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:autofillHints="password"
                    android:inputType="textPassword"
                    android:paddingRight="100dp" …
Run Code Online (Sandbox Code Playgroud)

android

5
推荐指数
0
解决办法
516
查看次数

尝试在空对象引用上调用虚方法'java.lang.String org.jsoup.nodes.Element.ownText()'

我使用下面的代码通过使用jsoup 从playstore获取versionName我正在获取详细信息,但它抛出了一些异常.

我的代码是

public class ForceUpdateAsync extends AsyncTask<String, String, JSONObject>{

private String latestVersion;
private String currentVersion;
private Context context;
public ForceUpdateAsync(String currentVersion, Context context){
    this.currentVersion = currentVersion;
    this.context = context;
}

@Override
protected JSONObject doInBackground(String... params) {

    try {
         latestVersion = Jsoup.connect("https://play.google.com/store/apps/details?id="+context.getPackageName()+"&hl=en")
                .timeout(30000)
                .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                .referrer("http://www.google.com")
                .get()
                .select("div[itemprop=softwareVersion]")
                .first()
                 .ownText();

    } catch (IOException e) {
        e.printStackTrace();
    }
    return new JSONObject();
}

@Override
protected void onPostExecute(JSONObject jsonObject) {
    if(latestVersion!=null){
        if(!currentVersion.equalsIgnoreCase(latestVersion)){ …
Run Code Online (Sandbox Code Playgroud)

java android jsoup

4
推荐指数
2
解决办法
3401
查看次数

在键盘识别滚动视图中的textInput之后按React-Native按钮

我有一个问题,我有一个的TextInput按钮KeyboardAwareScrollView.我希望用户输入一些文本,然后按下使用TouchableOpacity创建按钮.这将向前发送用户刚输入的文本.

问题是输入文本后,首先尝试TextInput只会失去焦点.只有在下次记者尝试是butto n实际压.如何在第一次按下时按钮有效?

我正在使用这个包https://github.com/APSL/react-native-keyboard-aware-scroll-view

我的代码如下:

import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'

export default class App extends Component<{}> {
  render() {
    return (
      <KeyboardAwareScrollView>
        <TextInput
          style={{ width: 100, height: 50, backgroundColor: 'blue' }}
        />
        <TouchableOpacity 
          style={{ backgroundColor: 'red', width: 50, height: 50 }}
        />
      </KeyboardAwareScrollView>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

javascript android ios reactjs react-native

3
推荐指数
1
解决办法
1270
查看次数

如何在notifyDataSetChanged之后阻止RecyclerView中的自动滚动?

我有RecyclerView几个项目类型.它看起来像这样:

  • 2017年7月21日
  • 消息1
  • 消息2
  • 消息3
  • 2017年7月22日
  • 消息4
  • 新邮件标题
  • 消息5
  • 消息6

当新消息到达时,我按日期和电话排序notifyDataSetChanged().它运作良好,但它会自动滚动我RecyclerView的新项目高度.在这种情况下,我无法使用,notifyItemInserted()因为我不知道排序后的项目位置.

没有通话RecyclerView后如何强制不滚动?notifyDataSetChanged()notifyItemInserted()

android android-recyclerview

2
推荐指数
2
解决办法
4874
查看次数

单击时如何不更改底部导航视图项目颜色

我有三件物品 bottomNavigationView

在此处输入图片说明

当我单击个人资料项时,代码会检查此人是否已登录。如果此人未登录,则我需要开始一个新的Activityelse 我需要fragment在我的frameLayout.

现在的问题是,当我单击配置文件项并且此人未登录时,活动开始,但是当我单击返回时,配置文件项会突出显示,但主页片段已加载到框架布局中。

在此处输入图片说明

我尝试了以下方法来解决这个问题

1)我曾经setSelectedItemId在点击个人资料项目时设置项目颜色但它不起作用

有没有其他方法可以做到这一点?

android android-fragments android-fragmentactivity bottomnavigationview

2
推荐指数
1
解决办法
4914
查看次数