且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

3.1.4缺少textAlignment(Android Studio)

更新时间:2023-11-20 10:29:10

这是我解决此问题的方式(在Android Studio 3.3-Build#AI-182.5107.16.33.5199772,建于2018年12月25日)上:

Here's how I resolved the problem (on Android Studio 3.3 - Build #AI-182.5107.16.33.5199772, built on December 25, 2018):

  1. 在Android Studio中,打开 build.gradle(模块:应用).
  2. 寻找 minSdkVersion
  3. 将其更改为17(从15开始)对我有用.我建议您尝试相同的方法,除非您确实需要更早些.
  4. Android Studio将重建您的项目,现在您应该在textStyle下方看到textAlignment属性.
  1. In Android Studio, open build.gradle (Module: app).
  2. Look for minSdkVersion
  3. Changing this to 17 (from 15) did the trick for me. I suggest you try the same, unless you really need it to be earlier.
  4. Android Studio will rebuild your project and you should now see the textAlignment attribute right below textStyle.

注意: 我遇到了同样的问题,并且我注意到TEXT_ALIGNMENT常量仅在API级别17中引入(请参见 https://developer.android.com/reference/android/view/View ).

Note: I had the same problem and I noticed that the TEXT_ALIGNMENT constants were only introduced in API level 17 (see https://developer.android.com/reference/android/view/View).

让我知道这是否有帮助.

Let me know if this helps.