小编xso*_*onz的帖子

在LinearLayout中将Imageview放在Imageview上

我坚持使用一些xml代码,希望你能帮助我.

所以这就是我现在需要的东西/我现在所做的.

我有3张650px宽的图像,我需要它们一个在另一个下方,同时保持宽高比.

我用以下代码完成了它,看起来应该如此.这里没问题.

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ll"
android:orientation="vertical"
android:background="#3afa3f"
android:weightSum="3">

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/krk_history"
    android:layout_weight="1"
    android:background="@drawable/povjestkrka_vintage_yellow600" />

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:id="@+id/krk_frankopan"
    android:background="@drawable/frankopan2_vintage_sundown600" />

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:id="@+id/krk_turizam"
    android:background="@drawable/krk_turizam_vintage"/>
Run Code Online (Sandbox Code Playgroud)

问题是.我需要在每个图像的左下角放置三个textview.想象一下它就像每个图像上带有文字描述的图像菜单.

所以,我不能使用相对或框架布局,因为图像不能很好地相互玩耍:)总是有一个差距,不是宽高比等等.我需要权重.

其次,我不能在photoshop中对每个图像上的文本进行硬编码,因为应用程序将被翻译,并且文本需要针对每种语言进行更改.

我可以为每种语言提供不同的图像,但我试图避免这种情况.

啊,是的,还有一件事.我尝试将整个线性布局放在相对布局中并将文本放在两者之间,但文本显示在图像下方,我无法预先显示它.

有什么建议?

非常感谢,Xsonz

css android image android-layout

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

标签 统计

android ×1

android-layout ×1

css ×1

image ×1