этот вопрос связан с этим. Моя активность не может реализовать lifecycleOwner Я полагаю, что этот вопрос может содержать ответ lifecycleOwner one. Я считаю, что этот ответ AppCompatActivity не реализует LifecycleOwner, но это не решило мою проблему
Я делаю проект Android в android. В каждом действии он просто не распознает мой импорт. как это:
private EditText edAccount;
edAccount = findViewById(R.id.edAccount);
он говорит: требуется: android.widget.EditText Found:android.view.View
Но я делаю imports android.widget.EditText
. Это произошло после того, как я импортировал новый библиотечный модуль. Но я не знаю, что происходит.
Кроме того, AppCompatActivity больше не реализует lifecycleOwner.
Спасибо за ваш ответ
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.finaldesigntest"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
}
buildToolsVersion '27.0.3'
productFlavors {
}
}
repositories {
flatDir {
dirs 'libs'
}
mavenCentral()
}
repositories {
flatDir { dirs project(':library').file('libs') }
// maven { url 'https://jitpack.io' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
}
allprojects {
repositories {
//jcenter()
//maven { url 'https://maven.google.com' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.contrarywind:Android-PickerView:4.0.1'
implementation 'com.android.support:support-annotations:27.1.1'
implementation project(':library')
compile 'io.reactivex.rxjava2:rxjava:2.1.6'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'android.arch.lifecycle:runtime:1.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'android.arch.lifecycle:reactivestreams:1.1.1'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
}
это макет активности.xml
<?xml version="1.0" encoding="utf-8"?>
<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_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.finaldesigntest.LoginActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal">
<TextView
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="18sp"
android:text="Account: "/>
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/edAccount"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal">
<TextView
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="18sp"
android:text="Password: "/>
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/edPassword"
android:layout_gravity="center_vertical"
android:inputType="textPassword"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/remember_pass"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:text="Remember password"/>
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:id="@+id/login"
android:text="Login"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/view_login_result"/>
</LinearLayout>
edAccount
- person Gotiasits   schedule 13.04.2018edAccount
в опубликованном .xml - person Gotiasits   schedule 13.04.2018