相关疑难解决方法(0)

将图像顶部对齐到TextView顶部

我想创建一个布局,将图像的顶部与TextView的顶部对齐,如下所示:

---------  Text text text text text text text
| Image |  text text text text text text text
---------  text text text text text text text
           text text text text text text text
           text text text text text.
Run Code Online (Sandbox Code Playgroud)

我尝试通过设置android:drawableLeft我的图像来做到这一点,但是它将图像垂直居中:

           Text text text text text text text
---------  text text text text text text text
| Image |  text text text text text text text
---------  text text text text text text text
           text text text text text. …
Run Code Online (Sandbox Code Playgroud)

android vertical-alignment textview drawable android-layout

38
推荐指数
1
解决办法
2万
查看次数

如何在文本视图的左上角设置可绘制对象?

<TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:drawablePadding="@dimen/padding_small_6"
        android:includeFontPadding="false"
        android:text="@string/forgot_password_hint"
        android:drawableStart="@drawable/ic_edit"
        android:textSize="@dimen/text_size_medium_14"/>
Run Code Online (Sandbox Code Playgroud)

这是我的文本视图。我想将可绘制对象设置在此文本视图的左侧。但问题是,如果文本是多行的,则可绘制对象在文本视图中显示为中心垂直。

是否有任何选项可以在文本视图的左上角设置可绘制对象?

android textview android-layout

5
推荐指数
1
解决办法
6671
查看次数