About 117,000 results
Open links in new tab
  1. Android: how to add Icon at the left side of the TextView

    Aug 13, 2014 · android:drawableLeft For your TextView and specify a drawable there your want to present on the left side of it.

  2. Android using icon in text of TextView - Stack Overflow

    Jun 21, 2021 · Yes, you can do it using SpannableString. See the below example: You could use VerticalImageSpan which is an extension to ImageSpan. And use the following TextView extension function takes in the index in the TextView that you want to place the drawable in; a drawable, the desired image width & height. val ssb = SpannableStringBuilder(this.text)

  3. Working With the TextView in Android - GeeksforGeeks

    Jun 21, 2024 · 7. Adding Icons for TextView. Android also allows adding drawable with the text views. There are three positions to add the icons for the TextView. They are a start, end, top, and bottom. Refer to the following code and its output, to know how to …

  4. Boost Your Android UI: Add Icons to TextView Easily - Lynxbee

    Learn how to add drawable icons alongside TextView in Android for better UI design. Step-by-step guide with XML and code examples.

  5. android - Custom TextView with icon - Stack Overflow

    use android:drawableTop to put the icon above the text and android:background just to draw the gray rectangle. Here you can find the documentation

  6. Android中TextView设置图标的方法 - CSDN博客

    Apr 12, 2019 · TextView可以设置左上右下4个图标,分为:布局和代码2种方式。 1.其中的drawableLeft、drawableTop、drawableRight、drawableBottom分别表示:左上右下的4个图标,drawablePadding表示文字与图标间的间距。 2.上述4个方位的图标,可以单独定义其中的某一个或几个。 3.此方式设置的图标只能按照图标本身的原始大小显示。 1.setCompoundDrawablesWithIntrinsicBounds方法的4个参数分别表示:左上右下的4个图 …

  7. How to set icons in TextView in Android - Programmer Sought

    TextView can set the top left and bottom right icons, divided into two ways: layout and code. 1. Among them, drawableLeft, drawableTop, drawableRight, and drawableBottom respectively represent: 4 icons on the top left and bottom right, and drawablePadding indicates the distance between the text and the icon. 2.

  8. android textview中间插入一个图标 - 51CTO博客

    Feb 4, 2024 · 本文将介绍如何在Android TextView中间插入一个图标,并附带代码示例。 要在TextView中间插入一个图标,我们可以借助SpannableString类来实现。 SpannableString是一个可以在文本中设置特定样式的类,它允许我们在文本中插入图片、改变字体颜色等。 具体实现步骤如下: 创建一个SpannableString对象,用于设置TextView的文本内容。 创建一个ImageSpan对象,用于插入图片。 将ImageSpan对象设置到SpannableString对象中的指定位置。 下面是一个 …

  9. An easy way to use font icon in Android | by Kevin Chung

    May 27, 2021 · Since it is a normal font, the simplest way to integrate it in Android is use TextView. First, copy icon font into “res/font” folder. For example, material design icon(mdifont.ttf). Then...

  10. 告别单调!Android TextView巧用图标,提升界面视觉体验

    Dec 28, 2024 · 在Android开发中,TextView是用于显示文本的组件,它本身可以提供丰富的文本格式化选项。 然而,当涉及到提升用户界面的视觉体验时,单纯依赖文本可能显得有些单调。 这时,我们可以通过在TextView中巧妙地插入图标来丰富界面,使其更加生动和直观。 本文将详细介绍如何在Android中实现这一效果。 1. 使用图标的原因. 在用户界面设计中,图标具有以下优势: 提升易用性:图标可以直观地传达信息,尤其是在文本说明不够清晰的情况下。 增加吸引力: …

  11. Some results have been removed
Refresh