0

I have an Activity with the dialog theme.

<activity
    android:name=".MyActivity"
    android:theme="@android:style/Theme.Dialog" />

That Activity uses the following xml layout:

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_article_frame_layout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#000000">
    <WebView
        android:id="@+id/activity_article_web_view"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
    <Button
    android:id="@+id/activity_article_close_button"
        android:layout_width="25dip"
        android:layout_height="26dip"
        android:layout_marginTop="5dip"
        android:layout_marginRight="5dip"
        android:layout_gravity="right|top"
        android:background="@drawable/close_button" />
</FrameLayout>

The content of the WebView will be loaded from a stored file on the sdcard (content provided as intent data). This happens in the onCreate():

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_article);

    // Handle to the WebView
    mWebView = (WebView) findViewById(R.id.activity_article_web_view);
    initWebView();
    mWebView.loadDataWithBaseURL(null, myHtmlContent, "text/html", "utf-8", null);

    // Handle to the close button
    mCloseButton = (Button) findViewById(R.id.activity_article_close_button);
    mCloseButton.setOnClickListener(this);
}

Project details: minSDK: 7 (2.1)

My problem is, that the WebView and/or the FrameLayout doesn't fill_parent. The height of the activity is exactly the same height used for the button. I can barely read the first line of my page. My problem happens only on honeycomb 3.x. Below (<=2.3) the Activity fills the parent and I see the complete website.

I tried to create the WebView dynamically. I tried to set the LayoutParams in the onCreate(). Nothing changed. I also tried to call invalidate() on FrameLayout and WebView but the result is the same...

WarrenFaith
  • 57,492
  • 25
  • 134
  • 150

2 Answers2

7

this solution worked for me:

How can I get a Dialog style activity window to fill the screen?

    @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.your_layout);

    getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
}
Community
  • 1
  • 1
Mike
  • 71
  • 1
  • 2
2

Try to use the RelativeLayout as FrameLayout, maybe it will work. I dont know if the FrameLayout accepts the fill_parent.

Informatic0re
  • 6,300
  • 5
  • 41
  • 56