如何设置布局的高度 [英] how to set height of layouts

查看:97
本文介绍了如何设置布局的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友的,
   我在设置布局的高度问题,我有三个布局单独的XML布局,

friend's, i have a problem in setting height of layout,i have three layout with seperate xml layout,

1.header.xml
            它有一个TextView的
  2.main.xml已经frmelayout与列表视图

1.header.xml it have an textview 2.main.xml have frmelayout with listview

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

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

在这里我的code获取解决方案

i need to know how to increase the height of the header as much i need,

here my code for getting solution

其实我在这里面临的问题ISI有头,菜单的画廊whrn iplace页眉下方我与hidded画廊的一半以下得到它,因为标题的高度不能被任何改变了这种看法图库某种意义上说,

Actually i'm facing problem here isi have gallery of menus in header ,whrn iplace this gallery view below header i'm getting it with hidded below half of the gallery,because the height of header can't being changed in any sense,

这里的code为header.xml

here the code for 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>

这里的code为main.xml中它具有的FrameLayout有列表视图,必须在顶级制表主机和的LinearLayout

here the code for main.xml it have an FrameLayout have listview,have tab host and linearlayout at top

<?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>

==================== code代表列表内容字段

==================== code for list content field

它有linerlayout三场对列表设置...

it have linerlayout with three field to set on list...

=====这里code代表我的活动

===== here code for my activity

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

。 ; ----帮我拿在头画廊的清晰无hidding底部或干脆我怎么能增加头部布局的高度

. ;.---- help me get the clear view of gallery in header without hidding at bottom or simply how can i increase height of header layout.

推荐答案

@MGSenthil:每个人都曾经是新来的。用简单的工作,不反对我们:)

@MGSenthil: everybody was once new here. Simply work with and not against us :)

返回话题:你的意思是用,因为头部的高度不能被任何意义改变?请澄清,如果你不能改变的高度,因为它没有工作,或者因为它是这个大小,你不能改变它呢?!

Back to topic: What do you mean with because the height of header can't being changed in any sense? Please clarify if you cant change the height because it didnt work or if you cant change it because it has to be this size?!

如果你想有一个特定的大小这个头,你应该考虑删除的内容的东西,以便它适合。

If you want to have this header with a specific size, you should consider to remove something of the content so it fits.

我从来没有使用一个自定义标题,但你应该检查其不是更好要求 NO_TITLE 键,只需将头添加到 main.xml中布局?你应该能够增加你的头的高度的方式。

I never used a custom title, but you should check if its not better to request NO_TITLE and simply add your header to the main.xml layout? You should be able to increase the height of your header that way.

这篇关于如何设置布局的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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