我开始使用Fabric,并且想要安装Crashlytics。按照说明,我已经在Android Studio中安装了Fabric插件。
我收到此错误:
错误:没有io.fabric.tools:gradle:1.+的缓存版本列表可用于脱机模式。
该插件对我的gradle进行了必要的更改,这些更改是:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.me.myapplication"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
buildscript {
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: …Run Code Online (Sandbox Code Playgroud) 正如我在问题中提到的,我正在尝试更改EditText中的提示字体.但我似乎无法实现它!
这是我获取用户名的EditText的代码:
<!-- Email Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:id="@+id/input_username_id"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="20dp">
<EditText
android:id="@+id/input_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:hint="@string/hint_username"
android:layout_marginRight="10dp"
android:gravity="right" />
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的java代码:
_usernameText = (EditText) (findViewById(R.id.input_username));
font = Typeface.createFromAsset(getAssets(), "fonts/ir.ttf");
_usernameText.setTypeface(font);
Run Code Online (Sandbox Code Playgroud)
这并没有改变EditText的提示字体.我尝试了其他解决方案而没有任何改变. http://chintanrathod.com/customizing-textinputlayout-part-2/
有一个问题是我的代码实际上在工作,但是当编辑文本为空时,我设置了一些要显示的文本。当我按下登录按钮时,我的应用程序崩溃了。这是错误:
android.view.InflateException:二进制XML文件行#17:二进制XML文件行#17:错误膨胀类TextView由以下原因引起:android.view.InflateException:二进制XML文件行#17:错误使TextView类膨胀引起于:java.lang .UnsupportedOperationException:无法解析索引4处的属性:TypedValue {t = 0x2 / d = 0x1010099 a = 1}
这是我的xml代码:
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="56dp"
android:paddingLeft="24dp"
android:paddingRight="24dp">
<ImageView android:src="@drawable/logo"
android:layout_width="wrap_content"
android:layout_height="72dp"
android:layout_marginBottom="24dp"
android:layout_gravity="center_horizontal" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:id="@+id/input_username_id"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:theme="@style/TextLabel"
android:layout_marginBottom="20dp">
<EditText
android:id="@+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:hint="@string/hint_username"
android:inputType="textEmailAddress"
android:layout_marginRight="10dp"
android:gravity="right" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_password_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="20dp"
android:theme="@style/TextLabel">
<EditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:hint="@string/hint_password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<android.support.v7.widget.AppCompatButton
android:id="@+id/btn_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginBottom="40dp"
android:padding="12dp"
android:paddingLeft="30dp"
android:background="@drawable/my_button"
android:drawableLeft="@drawable/ic_stat_login"
android:textColor="@color/white"
android:text="????"/>
<TextView android:id="@+id/link_signup"
android:layout_width="fill_parent" …Run Code Online (Sandbox Code Playgroud)