RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-22339

Andro's questions

Martin Hope
Andro
Asked: 2020-07-14 01:27:57 +0000 UTC

如何在 Android Studio 4.1 Beta 和 Canary 中使用模板?

  • 0

如何在 Android Studio 4.1 Beta 和 Canary 中使用模板???以前,您可以添加到 plugin/lib/templates/other 文件夹。现在这些文件夹不存在,工作室在创建时没有响应。因为一切都是从 Android.jar 文件中提取的

如果有人不明白什么是利害关系,那么关于这个https://habr.com/en/post/274959/

现在怎么样了???有没有人已经找到了使用他们的自定义项目的方法。像 MVP、MVVM、CLEAN 等等。因为每次都用笔做基本的东西很累

android
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-07-27 17:49:15 +0000 UTC

对话框显示不正确

  • 0

这就是布局的样子。

在此处输入图像描述 这是窗口启动时的样子

在此处输入图像描述


    <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:background="@android:color/darker_gray"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="16dp">

    <TextView
        android:id="@+id/txtMessage"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:fontFamily="@font/roboto"
        android:text="Please ajust Slideshow speed\nto make it the most comfortable\nfor you."
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/txtTitle"/>

    <TextView
        android:id="@+id/txtTitle"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:fontFamily="@font/roboto"
        android:text="Slideshow speed"
        android:textColor="@android:color/black"
        android:textSize="18sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <RadioGroup
        android:id="@+id/radioGroup"
        android:layout_width="0dp"
        android:layout_height="100dp"
        android:layout_marginTop="8dp"
        android:checkedButton="@+id/rbNormal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/txtMessage">

        <RadioButton
            android:id="@+id/rbSlow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:fontFamily="@font/roboto"
            android:text="Slow"/>

        <RadioButton
            android:id="@+id/rbNormal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:fontFamily="@font/roboto"
            android:text="Normal"/>

        <RadioButton
            android:id="@+id/rbFast"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:fontFamily="@font/roboto"
            android:text="Fast"/>
    </RadioGroup>

    <TextView
        android:id="@+id/txtOk"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:fontFamily="@font/roboto"
        android:text="LAUNCH"
        android:textAlignment="viewEnd"
        android:textColor="@color/color_text"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/radioGroup"/>
</android.support.constraint.ConstraintLayout>

这是 DialogFragment 调用代码

 @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.dialog_slideshow, container, false );
        unbinder = ButterKnife.bind(this, view);
        return view;
    }
android
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-13 20:58:55 +0000 UTC

RX如何结合使用application/json?

  • 1

界面

public interface IApiRequest {

    @POST("/v1/register")
    Observable<ResponseBody> makeRegister(@Body ApiBody.MakeRegister register);
}

要求

public class ApiRequest {

    private static IApiRequest init(){
        return new Retrofit.Builder()
                .baseUrl("https://slife.auth.andviro.pw")
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .build().create(IApiRequest.class);
    }

    public static Observable<ResponseBody> makeRegister(String email, String password){
        return init().makeRegister(new ApiBody.MakeRegister(email,password));
    }
}

挑战

ApiRequest.makeRegister("chhdjd@mail.ru","sadasd22")
                .doOnSubscribe(disposable -> {})
                .doFinally(() -> {})
                .subscribe(responseBody -> {
                    Log.e("Test", "main= " + responseBody.string());
                },Throwable::printStackTrace).dispose();

启动时出现错误

Exception in thread "main" java.lang.IllegalArgumentException: Unable to create @Body converter for class com.eranewgames.slife.network.ApiBody$MakeRegister (parameter #1)
for method IApiRequest.makeRegister

检查 PostMan 中的代码后,一切正常。我在代码中做错了什么?以前,我只使用表单/数据类型。这是应用程序/json

java
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-06 03:48:15 +0000 UTC

如何合并2个接口?

  • 2
etEmail.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {
        checkBtnContinue(s);
    }
});

etPass.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {
        checkBtnContinue(s);
    }
});

正如你所看到的,这两个元素做同样的事情,如何组合这段代码,使它看起来和读起来都很漂亮。

java
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-05 19:32:10 +0000 UTC

为什么 TextInputEditText 不能正常工作?

  • 2
<?xml version="1.0" encoding="utf-8"?>

<android.support.design.widget.TextInputLayout
    android:id="@+id/textInputLayout"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="32dp"
    android:background="@android:color/white"
    android:padding="8dp"
    android:textColorHint="@color/color_text_description"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView2"
    tools:ignore="MissingConstraints">

    <android.support.design.widget.TextInputEditText
        android:id="@+id/etEmail"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:inputType="textEmailAddress"
        android:imeOptions="actionNext"
        android:hint="@string/email_address"
        app:backgroundTint="@android:color/transparent"/>
</android.support.design.widget.TextInputLayout>

<TextView
    android:id="@+id/textView"
    android:layout_width="0dp"
    android:layout_height="1px"
    android:background="@android:color/transparent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textInputLayout"/>

<android.support.design.widget.TextInputLayout
    android:id="@+id/textInputLayoutPass"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:background="@android:color/white"
    android:padding="8dp"
    android:textColorHint="@color/color_text_description"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView"
    tools:ignore="MissingConstraints">

    <android.support.design.widget.TextInputEditText
        android:id="@+id/etPass"
        android:imeOptions="actionDone"
        android:inputType="textPassword"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:hint="@string/password"
        app:backgroundTint="@android:color/transparent"/>
</android.support.design.widget.TextInputLayout>

<ImageView
    android:id="@+id/imageView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="24dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/slife_logo"/>

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="27dp"
    android:layout_marginTop="8dp"
    android:text="Conscious life here and now"
    android:textColor="@color/color_text_description"
    android:textSize="16sp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/imageView4"/>

<TextView
    android:id="@+id/txtForgottenPas"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="8dp"
    android:fontFamily="@font/roboto_medium"
    android:text="FORGOTTEN PASSWORD?"
    android:textColor="@color/color_text"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textInputLayoutPass"/>

<Button
    android:id="@+id/btnLogin"
    android:layout_width="0dp"
    android:layout_height="60dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="64dp"
    android:text="LOG IN"
    android:enabled="false"
    android:background="@drawable/btn_auth"
    android:textColor="@color/text_auth"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/txtForgottenPas"/>

<TextView
    android:id="@+id/txtRegistration"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_marginTop="24dp"
    android:fontFamily="@font/roboto_medium"
    android:text="NEW USER/REGISTRATION"
    android:textColor="@color/color_text"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/btnLogin"/>

在此处输入图像描述

正如您在图片中看到的,电子邮件和密码这两个字段是相同的,但由于某种原因,密码字段无法正常工作。尽管在代码中一切都是一样的。问题是什么?如何删除下划线动画。?

android
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-02-13 15:51:19 +0000 UTC

如何在 Lolipop 中使用 Ripple 解决

  • 1

我想在 Android 16 API 中使用波纹视觉效果。来自 Google 的 Ripple 标准不适合。它支持 21 个 API。目前尚不清楚添加此功能有什么困难。简而言之,您不会了解 Google 的政策。来扭曲。

找到了一个图书馆。编译'com.balysv:material-ripple:1.0.2'。她的问题是 onclick 仅适用于父级。不能用于父视图和子视图。

有选择吗?AppComPact 波纹不存在)。我没有找到

java
  • 2 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-01-27 20:00:10 +0000 UTC

在 Kotlin 中未调用 CallBack

  • 1
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:orientation="horizontal">
    <fragment
          android:id="@+id/map"
          android:name="com.google.android.gms.maps.SupportMapFragment"
          android:layout_width="match_parent"
          android:layout_height="match_parent"/>
</LinearLayout>

-

 val supportMapFragment = map as SupportMapFragment
        supportMapFragment.getMapAsync { this }

我究竟做错了什么。不调用回调。 this显示错误The expression is unused


在此处输入图像描述


简而言之,这样反编译,垃圾结果

protected void onCreate(@Nullable Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      this.setContentView(2131296283);
      Fragment var10000 = this.getSupportFragmentManager().findFragmentById(id.map);
      if(var10000 == null) {
         throw new TypeCastException("null cannot be cast to non-null type com.google.android.gms.maps.SupportMapFragment");
      } else {
         SupportMapFragment supportMapFragment = (SupportMapFragment)var10000;
         supportMapFragment.getMapAsync((OnMapReadyCallback)(new OnMapReadyCallback() {
            public final void onMapReady(GoogleMap it) {
               MapsActivity var10000 = MapsActivity.this;
            }
         }));
      }
   }

为什么要创建 Android Studionew OnMapReadyCallback我已经创建了它并添加了这个......

java
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-01-17 03:19:00 +0000 UTC

gitIgnore 文件在 Android sTudio 中无法正常工作

  • 0

在此处输入图像描述

GitIgnore 文件没有正确忽略文件。该怎么办?

java
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-07-20 20:41:18 +0000 UTC

Android 中 MediaPlayer 的不可理解的错误

  • 0
 @Override
public void onPrepared(MediaPlayer mp) {
    try{
        mediaPlayer.setDisplay(surfaceHolder);
        mediaPlayer.start();
        videoControllerView.start();
        layoutProgressBar.setVisibility(View.INVISIBLE);
        RequestsRB.putStartWatchingVideo(this, mCourseId, mToken, mLessons.get(currentVideoNum).getId());
    }catch (Exception e){
        Log.e("WatchVideoActivity=onPrepared", "ERRROR" + "");
        if (mediaPlayer==null) Log.e("WatchVideoActivity=onPrepared", "DA1" + "");
        if (mp==null) Log.e("WatchVideoActivity=onPrepared", "DA2" + "");
    }
}

我得到了 NullPointer

if (mediaPlayer==null) Log.e("WatchVideoActivity=onPrepared", "DA1" + "");

粗略地说,它mediaPlayer是空的。并且 mp 不为空。好吧,它是一样的。我勒个去))。

请给我解释一下

顺便说一下 mediaPlayer 有 public static

java
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-07-17 13:57:45 +0000 UTC

如何在 ConstainLayout 中使 View 居中

  • 0

在此处输入图像描述

左边是现在的样子。右边是我想要实现的。

在 LinearLayout 中这很容易。重力=中心_垂直。如何在 ConstainLayout 中做到这一点?

原则上我可以让2个View上下空。并让他们 match_parent。但它不会看起来很漂亮。也许可以通过 ConstainLayout 以某种方式做到这一点?


我这样做了,但似乎并非如此。

    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center_vertical"
    android:layout_width="match_parent">
    <android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/background_login">

        <TextView
            android:id="@+id/textView5"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="Online Video Training"
            app:layout_constraintStart_toStartOf="parent"
            android:layout_marginStart="24dp"
            app:layout_constraintTop_toTopOf="parent"
            android:layout_marginTop="8dp"/>

        <TextView
            android:id="@+id/textView7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="32dp"
            android:text="Welcome"
            app:layout_constraintTop_toBottomOf="@+id/textView5"
            app:layout_constraintStart_toStartOf="@+id/textView5"
            android:layout_marginStart="0dp"/>

        <TextView
            android:id="@+id/textView10"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:text="Please Login"
            app:layout_constraintTop_toBottomOf="@+id/textView7"
            tools:layout_editor_absoluteX="24dp"/>

        <EditText
            android:id="@+id/etLogin"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="0dp"
            android:layout_marginTop="32dp"
            android:ems="10"
            android:inputType="textPersonName"
            android:text="Name"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/textView10"
            app:layout_constraintTop_toBottomOf="@+id/textView10"/>

        <EditText
            android:id="@+id/etPass"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginEnd="8dp"
            android:layout_marginStart="0dp"
            android:layout_marginTop="8dp"
            android:ems="10"
            android:inputType="textPersonName"
            android:text="Name"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/etLogin"
            app:layout_constraintTop_toBottomOf="@+id/etLogin"/>

        <CheckBox
            android:id="@+id/checkBox"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/remember_me"
            app:layout_constraintTop_toBottomOf="@+id/etPass"
            tools:layout_editor_absoluteX="24dp"/>

        <Button
            android:id="@+id/btnLogin"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginEnd="8dp"
            android:layout_marginTop="64dp"
            android:text="Log In"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/checkBox"
            app:layout_constraintTop_toBottomOf="@+id/checkBox"
            />

    </android.support.constraint.ConstraintLayout>

</LinearLayout>

狗屎一些代码结果

android
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-07-12 20:34:00 +0000 UTC

如何在Android Studio中快速启动一个应用程序?

  • 1

Android Studio 使用与 Jrebel 相同的系统来快速启动更准确的应用更新。

是否有任何线程用于快速更新应用程序的另一个系统。比如我换了class 1。更新应用程序后。

而且您无需重新爬上 10 个窗口即可到达 11 个窗口。Jrebel 不会更新应用程序。假设我在 11 号窗口。我按更新 Jrebel,结果没有改变

android
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-07-11 18:15:22 +0000 UTC

如何删除或清除 gitbucket 中的 master?

  • 2

如何删除或清除 gitbucket 中的 master?

git
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-07-10 16:55:01 +0000 UTC

如何在 xml Android 中禁用 RTL?

  • 0
    <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools"
             android:orientation="vertical"
             android:background="@color/transparent"
             android:layout_width="match_parent"
             android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_gravity="bottom"
        android:gravity="center_vertical"
        android:id="@+id/subtitlePanel"
        android:background="#66000000"
        android:layout_height="wrap_content">
        <ImageButton
            android:layout_width="50dp"
            android:id="@+id/subtitleLeftButton"
            android:background="@color/transparent"
            android:src="@drawable/ic_keyboard_arrow_left_24dp"
            android:layout_height="50dp"/>
        <TextView
            android:layout_width="match_parent"
            tools:text="textsd"
            android:gravity="center"
            android:id="@+id/subtitleText"
            android:textSize="16sp"
            android:lines="2"
            android:textColor="#fff"
            android:layout_weight="1"
            android:layout_height="wrap_content"/>
        <ImageButton
            android:layout_width="50dp"
            android:id="@+id/subtitleRightButton"
            android:background="@color/transparent"
            android:src="@drawable/ic_keyboard_arrow_right_24dp"
            android:layout_height="50dp"/>
    </LinearLayout>
</FrameLayout>

如果将语言更改为阿拉伯语,则向右看的箭头会发生变化。Tobish 她向左看。

是否可以在 Android 中使用某些参数在 XML 中说,当更改 ImageButton 中的 RTL 语言时,不要更改它。像 RTL 禁用之类的东西。我需要这个特定的视图不对更改 RTL ImageButton 做出反应

android
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-29 17:12:35 +0000 UTC

RecyclerView 没有正确处理 OnClickListerner

  • 1
@Override
public void onBindChildViewHolder(@NonNull final MyChildViewHodler childViewHolder, final int parentPosition, final int childPosition, @NonNull final Course child) {
    childViewHolder.childProgress.setTextColor(context.getResources().getColor(R.color.lerning_child));
    childViewHolder.childProgress.setVisibility(View.VISIBLE);
    childViewHolder.imgCertification.setVisibility(View.GONE);

    Log.e("MyLerningFragmentAdapter=CREATE", parentPosition + "  " + childPosition + "");

    if (parentPosition!=0){
        childViewHolder.rippleLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.e("MyLerningFragmentAdapter=CLICK", parentPosition + "  " + childPosition + "");
            }
        });
    }

显然,我没有以正确的方式添加监听器。那怎么办?

我需要在哪里添加它才能使其工作。我对 ListView 有同样的问题。这是附加的另一个视频。为了更清楚

有错误的视频

java
  • 2 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-29 04:01:12 +0000 UTC

如何覆盖Java中的类?

  • 0

有一个图书馆https://github.com/thoughtbot/expandable-recycler-view

我想覆盖一个类

public class ExpandableGroup<T extends Parcelable> implements Parcelable {
  private String title;
  private List<T> items;

  public ExpandableGroup(String title, List<T> items) {
    this.title = title;
    this.items = items;
  }

  public String getTitle() {
    return title;
  }

  public List<T> getItems() {
    return items;
  }

  public int getItemCount() {
    return items == null ? 0 : items.size();
  }

  @Override
  public String toString() {
    return "ExpandableGroup{" +
        "title='" + title + '\'' +
        ", items=" + items +
        '}';
  }

  protected ExpandableGroup(Parcel in) {
    title = in.readString();
    byte hasItems = in.readByte();
    int size = in.readInt();
    if (hasItems == 0x01) {
      items = new ArrayList<T>(size);
      Class<?> type = (Class<?>) in.readSerializable();
      in.readList(items, type.getClassLoader());
    } else {
      items = null;
    }
  }

  @Override
  public int describeContents() {
    return 0;
  }

  @Override
  public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(title);
    if (items == null) {
      dest.writeByte((byte) (0x00));
      dest.writeInt(0);
    } else {
      dest.writeByte((byte) (0x01));
      dest.writeInt(items.size());
      final Class<?> objectsType = items.get(0).getClass();
      dest.writeSerializable(objectsType);
      dest.writeList(items);
    }
  }

  @SuppressWarnings("unused")
  public static final Creator<ExpandableGroup> CREATOR =
      new Creator<ExpandableGroup>() {
        @Override
        public ExpandableGroup createFromParcel(Parcel in) {
          return new ExpandableGroup(in);
        }

        @Override
        public ExpandableGroup[] newArray(int size) {
          return new ExpandableGroup[size];
        }
      };
}

这样您就可以使构造函数为空。和变量

String title, List<T> items通过设置器添加。

我的问题是List<T>.

我如何重写此类以使构造函数变为空?而且写入数据不方便

在此处输入图像描述

不能覆盖。怎样成为?

java
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-28 23:31:26 +0000 UTC

如何简化具有多个存储库的 Git 的任务?

  • 2

我有 1 个项目并将其克隆到 5 个存储库。

每个存储库现在就像一个单独的应用程序。

问题。

如果有错误或某种功能需要添加到所有项目中。为了不为每个存储库手动执行此操作,是否可以以某种方式加快此过程。通过 Git?

git
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-26 23:22:07 +0000 UTC

获取View后如何使用switch?

  • 0

获取视图后如何

View view = LayoutInflater.from(context).inflate(R.layout.dialog_bs_lerning, null);

用于switch此Layout?

成为类似的东西

Switch(v.getid) {
    case
}

然后我有一个不可读的代码,结果是 6 个setOnClickListener

android
  • 2 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-23 22:34:34 +0000 UTC

如何将整个应用程序包装在 Fabric 中?

  • 0

布料又歪了。

NullPointer 类型错误,服务器什么也没有。

我如何将整个应用程序与所有 Acitvity 包装在 Crashlictys.loge 中?在 oncreate 中写 try catch after 在 onresume 中,destroy 在每个类的所有函数中都较短或什么?

android
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-22 02:16:00 +0000 UTC

EditText 与适配器有问题

  • 2
    public class AdapterList extends RecyclerView.Adapter<AdapterList.ParentViewHolder>{
    private String mDataSet[];
    private Context context;

    public AdapterList(Context context,String data[]) {
        mDataSet = data;
        this.context=context;
    }

    @Override
    public ParentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ParentViewHolder(LayoutInflater.from(context).inflate( R.layout.adap,null ));
    }

    @Override
    public void onBindViewHolder(final ParentViewHolder holder, final int position) {
//        holder.anameTxtView.setText(mDataSet.get(position).getDname());
//        holder.abalanceTxtView.setText(mDataSet.get(position).getDbalance());
        holder.editText.setText( mDataSet[position] );

        holder.editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (!hasFocus){
                    String str=holder.editText.getText().toString();
                    holder.editText.setText( str );
                    mDataSet[position]=str;
                }
            }
        });

    }


    @Override
    public int getItemCount() {
        return mDataSet.length;
    }

    class ParentViewHolder extends RecyclerView.ViewHolder {
        private EditText editText;

        public ParentViewHolder(View itemView) {
            super(itemView);
            editText= (EditText) itemView.findViewById(R.id.text);
        }
    }
}

在此处输入图像描述

我想看着 gif 一切都会清楚我的问题是什么

适配器

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="wrap_content">
        <android.support.v7.widget.AppCompatEditText
            android:textColor="#000"
            android:id="@+id/text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>
</LinearLayout>
java
  • 1 个回答
  • 10 Views
Martin Hope
Andro
Asked: 2020-06-20 17:10:54 +0000 UTC

如何在不创建新文件的情况下很好地更改 dp 值?

  • 2

我有这样的Drawable。我有 5 个窗口。对于每个我都使用这个 drawable 但具有不同的半径 dp 值。

为每个人创建一个 drawable 是不对的。是的,会产生很多代码,然后阅读起来会很不愉快。是否有可能以某种方式改变代码的最小变体的精神?

例如,在 dimens 中指定 dp。然后在第二个窗口中获取此维度以更改值 并为 drawable 更改值。但我试过它没有用。)

    <?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/whiteBg"/>
    <corners android:radius="10dp"/>
</shape>
android
  • 3 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5