Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4624752
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:10:25+00:00 2026-05-22T03:10:25+00:00

Im using a customized webview as follows <merge xmlns:android=http://schemas.android.com/apk/res/android xmlns:MyWebView=http://schemas.android.com/apk/res/com.mds.android.mireader.webview android:background=#FFFFFF android:layout_height=fill_parent android:layout_width=fill_parent> <com.mds.android.mireader.webview.MyWebView

  • 0

Im using a customized webview as follows

<merge
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:MyWebView="http://schemas.android.com/apk/res/com.mds.android.mireader.webview"   android:background="#FFFFFF"  android:layout_height="fill_parent" android:layout_width="fill_parent">


 <com.mds.android.mireader.webview.MyWebView
 xmlns:android="http://schemas.android.com/apk/res/android"  android:id="@+id/myweb"     **android:layout_width="318px"**  android:layout_height="fill_parent" > </com.mds.android.mireader.webview.MyWebView>

im doing some thing strange, for that i need to satisfy following condition

condition: webview width should always divisible by 3

So i can’t give fixed value or fill_parent in above xml file.For example if i give fill_parent it works fine for portrait(assume HVGA emulator with portrait width=480 which is divisible by 3)but no success for landscape(bcz landscape width 800 which is not divisible by 3).

Solution should work for both orientation change and device change”

Im struggling with 1 or 2 pixel values difference and it will be solved if i satisfy that condition. TIA ….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:10:26+00:00Added an answer on May 22, 2026 at 3:10 am

    HI,

    You can get the height and width of the screen using following piece of code:

    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    int height = displaymetrics.heightPixels;
    int width = displaymetrics.widthPixels;
    

    Now you have the width you can check whether it is divisible by 3 or not. If yes then well and good, otherwise you can subtract the modulus(width%3) from the original width and set it as the width of your webview.

    Add A View Programmatically:

    Sample XML:

    <LinearLayout (define id:testLayout, width, height here> </LinearLayout>
    

    Java Code:

    LinearLayout linLayout = (LinearLayout) findViewById(R.id.testlayout);
    // create an object of your webview and set all the properties you want like background color etc.
    MyWebView myWebView = new MyWebView(); 
    
    linLayout.addView(myWebView, new LinearLayout.LayoutParams(<my calculated width>, LayoutParams.FILL_PARENT);
    

    PS: you dont have to add the webview object in your XML file. “addView” function will add your webview inside your linear layout object.

    Hope this helps!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing one android application in which I'm using one customized ListView which extends
We are developing customized installer using visual studio 2008 installer project. The requirement which
We are developing a customized installer using Wix and Wpf. We have developed some
I am using map kit and showing customized annotation view. One is carImage and
When a class is customized, by using its outlet , you cant access its
I am currently using Hibernate Tools 3.1; I customized naming convention and DAO templates.
I'm using the standard Apple moviePlayer sample code and have customized it to play
Right now I'm using Trac with multiple projects and have customized the project-listing template
I have been using some customized MVC templates that really improve my productivity. However,
I'm using a customized JToolbar using the following code: public class GeneralToolbar extends JToolBar{

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.