获得具有WRAP_CONTENT财产布局的高度
我有一个简单的表和滚动视图
滚动的的TableRow
。我还添加了脚注问题是,我需要知道什么是页脚的大小,这样我就可以给的android:layout_marginBottom =< footerbar&GT的尺寸;
我的滚动视图。因此,如何能拿到页脚栏布局的高度?请帮助我。
I have a simple table and a scrollView
for scrolling the TableRow
. I had also added footer the problem is that i need to know what is the size of footer so I can give the android:layout_marginBottom="<size of footerbar>
to my scrollView. So how can i get the height of the layout of footer bar? please help me.
这是我的footerbar code:
this is my footerbar code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/btnColor"
android:orientation="horizontal" >
<Button
android:id="@+id/previous"
style="@style/pagingBarBtnAttr"
android:layout_alignParentLeft="true"
android:background="@drawable/choose_color_btn"
android:drawableLeft="@drawable/previous"
android:text="Previous" />
<TextView
android:id="@+id/pageNo"
style="@style/pagingBarBtnAttr"
android:layout_centerHorizontal="true"
android:text="Page No. 1" />
<Button
android:id="@+id/next"
style="@style/pagingBarBtnAttr"
android:layout_alignParentRight="true"
android:background="@drawable/choose_color_btn"
android:drawableRight="@drawable/next"
android:text="Next" />
现在作为下和previous按钮有一个可绘制,使他们根据装置的大小有绘制这样的页脚栏具有高度的不固定值,所以我怎样才能得到它的高度,所以我可以提供该值 margin_bottom
的滚动视图
。在此先感谢..
now as the next and previous button has a drawable so they have the drawable according to device size so the footer bar has no fixed value of its height so how can i get its height so i can supply that value to margin_bottom
of scrollview
. Thanks in advance..
请参考下面的code
Refer the below code
首先添加的页脚在XML文件中,并设置其 alignParentBottom ,以正确的。
First add footer in your xml file and set its alignParentBottom to true.
然后,添加滚动视图,并设置它的 layout_above 与页脚id属性
Then add scrollView and set its layout_above property with the footer id
<LinearLayout
android:id="@+id/imgFooter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imgFooter"
android:layout_below="@id/nav_bar_header"
android:layout_centerHorizontal="true"
android:padding="5dp" >
</ScrollView>