【问题标题】:how to set height of layouts如何设置布局的高度
【发布时间】:2010-08-17 10:32:29
【问题描述】:

朋友的, 我在设置布局高度时遇到问题,我有三个单独的 xml 布局的布局,

1.header.xml 它有一个文本视图 2.main.xml有frmelayout和listview

  3.content.xml
        it have field to bind in framelayout listview.

我需要知道如何尽可能增加标题的高度,

这里是我获取解决方案的代码

实际上我在这里遇到了问题,我在标题中有菜单库,当将此图库视图放在标题下方时,我将其隐藏在图库的一半下方,因为标题的高度无法更改感觉,

这里是 header.xml 的代码

 <?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" android:background="@drawable/gradient_black"
    android:layout_gravity="center_horizontal" android:layout_width="fill_parent"
    android:orientation="horizontal">
    <ImageView android:src="@drawable/image_button1" android:id="@+id/back"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_centerVertical="true"/>
    <TextView android:id="@+id/header_text1" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_toRightOf="@+id/back"
        android:textSize="20sp" android:textStyle="bold" android:textColor="@color/white"
        android:layout_marginLeft="60dip" android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" android:ellipsize="end"
        android:singleLine="true" />
    <ImageView android:src="@drawable/image_button" android:id="@+id/share"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/header_text1" android:paddingTop="10dip"
        android:paddingLeft="50dip" />
      <Gallery android:id="@+id/gv" android:layout_width="fill_parent" android:paddingTop="0dip"
          android:layout_height="fill_parent" android:spacing="15dip"
             android:layout_below="@+id/back"
           android:gravity="bottom" android:paddingBottom="0dip"/> 
</RelativeLayout>

这里是 main.xml 的代码,它有一个 FrameLayout 有列表视图,有标签主机和顶部的线性布局

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
      <LinearLayout  android:layout_width="fill_parent"
        android:layout_height="200dip" android:id="@+id/main_lay">    


<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:id="@android:id/tabcontent"
        android:layout_width="fill_parent" android:layout_height="100dip"
        android:layout_marginTop="100dip">
    <ListView android:id="@+id/content_listview"
            android:layout_width="fill_parent" android:layout_height="340dip" />
</FrameLayout>

.
.
.
</LinearLayout>
----
</TabHost>

==================== 列表内容字段的代码

它有 linerlayout 与三个字段设置在列表中...

===== 我的活动代码

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.main); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.header);

。 ;.---- 帮助我在标题中获得清晰的画廊视图,而不会隐藏在底部,或者只是如何增加标题布局的高度。

【问题讨论】:

  • 我们需要 XML 代码,否则:layout_height 是我的答案

标签: android


【解决方案1】:

正如 WarrenFaith 所说,如果没有 XML 代码,我们将无法帮助您。您提供的信息的基本答案是 layout_height 但您可以将 fill_parent 和 layout_weight 设置为其他字段,并且不会相同。请提供一些代码

【讨论】:

  • 朋友,我发布了我的xml代码,请通过它并帮助我。
  • 朋友,我在这里发布了我的代码,请通过它并帮助我。
  • 正如我和 WarrenFaith 所说,你打开了一个新线程,所以关闭这个
  • 对不起朋友们,我很新用这个
【解决方案2】:

@MGSenthil:这里的每个人都曾经是新人。只需与我们合作而不是反对我们:)

返回主题:because the height of header can't being changed in any sense 是什么意思?请澄清您是因为它不起作用而不能改变高度,还是因为它必须是这个尺寸而不能改变它?!

如果您希望此标题具有特定大小,则应考虑删除某些内容以使其适合。

我从未使用过自定义标题,但您应该检查一下请求NO_TITLE 并简单地将您的标题添加到main.xml 布局是否更好?您应该能够以这种方式增加标题的高度。

【讨论】:

    猜你喜欢
    • 2016-01-23
    • 1970-01-01
    • 2016-04-25
    • 2011-07-18
    • 1970-01-01
    • 2011-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多