android - TextInputLayout 错误文本填充

标签 android material-design android-appcompat android-textinputlayout

我将 TextInputLayoutAppCompatEditText 一起使用,为 AppCompatEditText 设置基于自定义 xml 形状的背景。每当我设置一些错误时,错误行从布局的开头开始。有什么方法可以填充该错误行。

enter image description here

最佳答案

您可以使用以下方法引用错误 TextView:

TextView textView = (TextView) inputLayout.findViewById(android.support.design.R.id
            .textinput_error);

然后你可以得到它的布局参数来使用。

关于android - TextInputLayout 错误文本填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34917677/

相关文章:

angular - 如何在 Angular 4 中翻译 mat-paginator?

android - NestedScrollview 重叠 CollapsingToolbarLayout 像 gmusic app

android - 无法解决 com.android.support :appcompat-v7:22 and com. android.support :recyclerview-v7:21. 1.2

android - 使用 ListFragment 时无法引用 ListView

java - 将列表写入 Parcelable?

android - 如何从可完成中引发错误

javascript - Phonegap 3 上有 onExit 或 onDestroy 方法吗?

android - 如何在 Titanium 中使用 Android Material Theme Design 属性(彩色状态栏,...)

android - CoordinatorLayout 中的 ViewPager 意外收缩

android - 找不到引用的组件 'Xamarin.Android.Support.v7.AppCompat' Xamarin.Android