我一直在搜索Google和stackoverflow一段時間,並沒有發現任何回答我的問題。Android Webview與底部的孩子
我想知道在WebView
的底部放置一個LinearLayout
(像素沒有特定的已知高度)。此LinearLayout
稍後將填入一個片段,其中包含WebView
中顯示的文章的註釋。
問題的問題是WebView
幾乎總是大於屏幕,因此用戶必須滾動才能閱讀完整文章。在滾動的底部,我想插入CommentsFragment
(通過LinearLayout
,它需要一些參數,因此不能直接從XML中加載)。
我試過了一堆解決方案,但所有這些都使LinearLayout
堅持佈局的底部,而不是在WebView
的底部。
我當前的代碼如下,當然不工作:
<?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="fill_parent" >
<WebView
android:id="@+id/article_webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true" />
<LinearLayout
android:id="@+id/comments_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
謝謝您的幫助!
你是否想要評論frgament會低於webview? – 2013-03-16 12:23:15
是的正確,我還沒有解決它 – 2013-03-18 09:50:04
試試我的答案在下面。 – 2013-03-18 10:11:13