带有图片和文字的小部件

问题描述 投票:-1回答:1

我想创建一个小部件,其图像和图像在图像下方。widget i want

如果我编写此代码:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/myImageView"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:src="@drawable/cat1" />
    <TextView
        android:id="@+id/text_widget"
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:background="#808080"
        android:text="@string/widget_text"/>

</LinearLayout>

我有没有文字的图片。而且我想知道如果文本长度可变,该如何做一个小部件

如果使用相对布局,则文本在图像上方

android widget android-widget
1个回答
0
投票

文本将在图像下方

© www.soinside.com 2019 - 2024. All rights reserved.