【问题标题】:Space between TextView in android spinnerandroid微调器中TextView之间的空间
【发布时间】:2021-01-21 20:01:45
【问题描述】:

我正在尝试为微调器内的 textView 设置边距。但是在 textView 中设置边距似乎不起作用。

tv_entity.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/tvListEntity"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:background="@drawable/item_search_list"
    android:fontFamily="@font/poppins_bold"
    android:gravity="center_vertical"
    android:paddingStart="40dp"
    android:paddingEnd="20dp"
    android:text="@string/enter_email"
    android:textColor="@color/search"
    android:textSize="15sp"
    app:drawableRightCompat="@drawable/ic_baseline_add_circle_24"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_goneMarginTop="20dp" />

设置适配器:-

  val arrayAdapter = ArrayAdapter(requireContext(),R.layout.tv_entity,arrayList)

我基本上需要在 textView 的左右和顶部留出一些空间。

【问题讨论】:

    标签: android xml android-layout kotlin material-design


    【解决方案1】:

    将 android:layout_height="40dp" 替换为 android:layout_height="wrap_content" 和 app:layout_goneMarginTop="20dp" 替换为 android:paddingTop="20dp"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-14
      • 1970-01-01
      • 2016-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-01
      相关资源
      最近更新 更多