minHeight有什么作用吗? [英] does minHeight do anything?

查看:789
本文介绍了minHeight有什么作用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在附件的图像中,我希望按钮的列与图像的高度匹配,但我也希望按钮列的高度最小.

In the attached image, I want the column of buttons to match the height of the image, but I also want there to be a minimum height for the column of buttons.

它正确匹配图像的高度,但不遵守minHeight,因此会将按钮缩小.

It correctly matches the height of the image, but does not respect the minHeight, and will smoosh the buttons down.

我正在为按钮列设置以下属性:

I am setting these properties for the column of buttons:

<LinearLayout
   ...
   android:layout_alignTop="@+id/image"
   android:layout_alignBottom="@+id/image"
   android:minHeight="150dp"
   >

推荐答案

我不知道您的所有确切要求,但看来您可以像在图中一样用另一层来解决此问题.在外部布局上设置minHeight,然后在内部设置fill_parent/match_parent.也许像这样:

I don't know all your exact requirements, but it seems you can solve this with another layer pretty much like in your diagram. Set the minHeight on an outer layout and then just fill_parent/match_parent on the inside. Maybe something like:

<LinearLayout
    android:orientation="horizontal"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:minHeight="150dp">
    <LinearLayout
        android:orientation="vertical"
        android:layout_height="fill_parent"
        android:layout_width="wrap_content">
    </LinearLayout>
    <ImageView />
</LinearLayout>

这篇关于minHeight有什么作用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆