2016-03-30 214 views
1

HTML下面在Webview中无法正常显示。巨大的照片和小文本?这怎么解决?我为视口设置了元数据,这对文本有帮助,但是如果有大图像,文本会缩小?以下是移动设备中的html文本仅占屏幕的1/3。Android WebView图片太大

enter image description here

<html> 
<head> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, user- scalable=yes"> 
</head> 
<body> 
    <h1>Fox News is getting really good at spotting Ted Cruz’s lies.</h1> 
    <div class="newbody body parsys"><span> 

    </span><div class="parbase image slate_image section"><span> 
    </span><div class=""><span> 
    </span><figure class="image inline "> <img src_tag_name="src" title="Ted Cruz " alt="Ted Cruz " src="http://www.slate.com/content/dam/slate/articles/news_and_politics/politics/2016/01/160129_pol_ted-cruz_1024.jpg.CROP.promo-xlarge2.jpg"> <figcaption class="caption"><span>Ted Cruz speaks during the Republican presidential debate sponsored by Fox News in Des Moines, Iowa, on Jan. 28, 2016.</span></figcaption> <p class="credit">Jim Watson/Getty Images</p> 
    </figure><span> 
    </span></div><span> 
    </span> 
<script> 
    requirejs(["jquery"], function($) { 
     if ($(window).width() < 640) { 
      $(".slate_image figure").width("100%"); 
     } 
    }); 
    </script> 
<span> 
</span></div><span> 

[![enter image description here][1]][1]</span><div class="text text-1 parbase section"><span> 

</span><p>In Thursday night’s Republican presidential debate, moderator Megyn Kelly <a href="https://www.washingtonpost.com/news/the-fix/wp/2016/01/28/7th-republican-debate-transcript-annotated-who-said-what-and-what-it-meant/">grilled Sen. Ted Cruz</a> about his role in the Senate’s 2013 fight over immigration reform. As <strong><em>Slate</em></strong> recently explained, that fight is <a href="http://www.slate.com/articles/news_and_politics/politics/2016/01/the_definitive_timeline_of_what_ted_cruz_said_and_did_in_the_2013_immigration.html?wpsrc=sp_all_article_storypromo">an excellent episode to study</a> if you want to understand Cruz’s <a href="http://www.slate.com/articles/news_and_politics/cover_story/2016/01/ted_cruz_may_be_the_most_gifted_liar_ever_to_run_for_president.html">peculiar views about truth and deception</a>. By pressing Cruz about discrepancies between what he said then and what he says now, Kelly forced him to show the public, on live television, how he thinks about honesty. It wasn’t pretty.</p><span> 


</span></div><span> 




</span><section class="about-the-author fancy inline with-head"> 

<div class="author-bio"><p>Will Saletan writes about politics, science, technology, and other stuff for <b><i>Slate</i></b>. He’s the author of <i><a target="_blank" href="http://rads.stackoverflow.com/amzn/click/0520243366">Bearing Right</a></i>.<a href="http://rads.stackoverflow.com/amzn/click/0520243366"><i><br></i></a></p><span> 
</span></div> 

</section><span> </span><!-- /.about-the-author --><span> 


</span><div class="text-2 text parbase section"><span> 

</span><p>Kelly showed the debate audience four video clips. In the clips, taken from Cruz’s speeches during the 2013 fight, he earnestly appealed for a compromise that would allow undocumented immigrants to earn legal status—as prescribed by a bill the Senate was considering—but not citizenship. The key to the compromise was an amendment, offered by Cruz, that would have <a href="http://www.judiciary.senate.gov/imo/media/doc/Cruz3-(DAV13373).pdf">closed the path to citizenship</a>. Cruz now denies that he ever supported legalization. Here’s how he tried to explain the video clips, and what the exchange revealed about him.</p><span> 


</span></div><span> 




</span><span> 


</span><div class="text-3 text parbase section"><span> 

</span><p><strong>1. He lies.</strong> Kelly’s first clip, taken from Cruz’s speech in the Senate Judiciary Committee on May 9, 2013, showed him saying, “<a href="http://www.cruz.senate.gov/?p=press_release&amp;id=140">I don’t want this bill to be voted down</a>.” The second clip, taken from his speech to the committee on May 21, 2013, showed him saying, “<a href="http://www.cruz.senate.gov/?p=press_release&amp;id=128">If [my] amendment were to pass, the chances of this bill passing into law would increase dramatically</a>.” The third clip, taken from Cruz’s <a href="http://web.princeton.edu/sites/jmadison/calendar/flash/Cruz.html">remarks at Princeton University</a> on May 31, 2013, showed him saying: “I believe if the amendments I introduced were adopted, that the bill would pass. And my effort in introducing them was to find a solution that reflected common ground and that fixed the problem.”</p><span> 


</span></div><span> 

</span><div class="text parbase text-4 section"><span> 

</span><p>Cruz, like everyone else at Thursday’s debate, watched these clips as Kelly played them. Each clip showed him pleading for the bill. But in an <a href="https://www.youtube.com/watch?v=yUV_HiSxwfA">interview after the debate</a>, he denied that he had done so:</p><span> 


</span></div><span> 







</span><div class="text parbase text-5 section"><span> 

</span><blockquote><strong>Kelly:</strong> [You were] trying to sell it, saying, “I want the bill to pass.”<strong><br>Cruz:</strong> But—no, no. What I said is, “I want <em>immigration reform</em> to pass.”<strong><br>Kelly:</strong> You also said the bill.<strong><br>Cruz:</strong> I didn’t say I want the bill to pass. I promise you.</blockquote><span> 


</span></div><span> 

</span><div class="text text-6 parbase section"><span> 

</span><p>This is the <a href="http://www.slate.com/articles/news_and_politics/cover_story/2016/01/ted_cruz_may_be_the_most_gifted_liar_ever_to_run_for_president.html">third time in two months</a> that Cruz has tried to hoodwink a Fox News interviewer on this subject. Bret Baier’s rebuke to Cruz on Dec. 16—“<a href="http://video.foxnews.com/v/4664479751001/sen-ted-cruz-this-is-a-nation-at-war/">You said the bill</a>”—is almost identical to Kelly’s, and Cruz also attempted to <a href="http://video.foxnews.com/v/4667702262001/cruz-obama-hillary-dems-out-of-touch-with-american-people/">put one past Greta Van Susteren</a> on Dec. 18. Last week, Cruz tried to <a href="http://abcnews.go.com/Politics/ted-cruz-donald-trumps-immigration-policy-amounts-amnesty/story?id=36431907">fool ABC’s George Stephanopoulos</a>. Stephanopoulos noted that in an April 2013 CBS interview, Cruz had said “there could be a compromise” on legal status for undocumented immigrants. Cruz told Stephanopoulos that his compromise offer wasn’t about legal status. That’s <a href="https://www.youtube.com/watch?v=Yf2J6OhUHcQ">not true</a>. The question in the 2013 interview was: “What would you do with the 11 million people who are here illegally?” And Cruz’s answer was, “I think there could probably be a compromise on that, if a path to citizenship was taken off the table.”</p><span> 


</span></div><span> 

</span><div class="text parbase text-7 section"><span> 

</span><p><strong>2. He judges his own honesty by technicalities, not by the plain meaning of his words. </strong>During the debate, Kelly told Cruz, “You proposed an amendment. It would have allowed for legalization but not citizenship.” Cruz shook his head in denial. He pointed out that his amendment “didn’t say a word about legalization.” Technically, that’s true: The <a href="http://www.judiciary.senate.gov/imo/media/doc/Cruz3-(DAV13373).pdf">amendment</a> didn’t use the words <em>allow</em> or <em>legal status</em>. But Cruz did. On May 21, 2013, he <a href="http://www.cruz.senate.gov/?p=press_release&amp;id=128">told the Judiciary Committee</a> that the bill’s proponents explicitly sought “to provide a legal status for those who are here illegally, to be out of the shadows. This amendment would allow that to happen.” On June 4, 2013, he issued a <a href="https://www.scribd.com/doc/145879453/Letter-from-Sens-Cruz-Sessions-Lee-Grassley-Voicing-Concerns-with-S-744">letter</a> that said his amendment “would have allowed immigrants here illegally to obtain legal status—to come out of the shadows and work legally.” Like Bill Clinton, who famously staked his truthfulness on “the meaning of <em>is</em>,” Cruz now stakes his honesty on a creative reinterpretation of the word <em>allow</em>.</p><span> 


</span></div><span> 

</span><div class="text parbase text-8 section"><span> 

</span><p><strong>3. He’s an actor.</strong> After showing the videos of Cruz’s appeals for compromise, Kelly asked him, “Was that all an act? It was pretty convincing.” In the post-debate interview, she told him: “It just seems weird for the average person to see, like, the acting, when you’re trying to sell it, saying, ‘I want the bill to pass.’ ” Kelly said she didn’t think Cruz was lying in 2016 about his motives in 2013. But in that case, what he said in 2013 was, as, she put it, acting. And acting, in this context, is just a nicer word for lying. As Sen. Rand Paul noted during Thursday’s exchange:</p><span> 


</span></div><span> 

</span><div class="text parbase text-9 section"><span> 

</span><blockquote>I was there, and I saw the [immigration] debate. I saw Ted Cruz say, “We’ll take citizenship off the table, and then the bill will pass, and I’m for the bill.” … What is particularly insulting, though, is that he is the king of saying, “You’re for amnesty.” Everybody’s for amnesty except for Ted Cruz. But it’s a falseness, and that’s an authenticity problem.  </blockquote><span> 


</span></div><span> 

</span><div class="text parbase text-10 section"><span> 

</span><p><strong>4. He misleads everyone, not just his enemies. </strong>In the post-debate interview, Kelly noted that in 2013, Cruz had mimicked pro-legalization catchphrases. She told him: “You were talking about people coming ‘out of the shadows.’ It seems like acting.” Cruz told Kelly that he had done this to toy with liberals: “What I often do, particularly when debating Democrats—and I was debating [Sen.] Chuck Schumer there—is use the language of the Democrats, to show their hypocrisy.” Cruz wants conservatives to believe they can trust him because he reserves his deceptions for the left.</p> <span> 


</span></div><span> 

</span><div class="text-11 text parbase section"><span> 

</span><p>But in 2013, Cruz didn’t just put on the act for Democrats. As Sen. Marco Rubio pointed out Thursday, Cruz also dangled the compromise offer in his interview with CBS. One of the clips Kelly played showed Cruz making <a href="http://web.princeton.edu/sites/jmadison/calendar/flash/Cruz.html">a similar pitch</a> to his former professor, Robert George, a leading conservative thinker and activist. Cruz also put on his earnest-compromiser act for conservative journalist <a href="https://www.youtube.com/watch?v=rD6LcVRDK4E">Byron York</a>. In fact, Cruz’s office <a href="http://www.washingtonexaminer.com/byron-york-ted-cruz-opens-up-on-immigration/article/2530773/">requested the interview</a> with York, ostensibly to clear the record. And later, in a June 2013 interview with Rush Limbaugh, Cruz <a href="http://www.rushlimbaugh.com/daily/2013/06/19/interview_senator_cruz_on_the_amnesty_bill">bragged about a poll of Texas Hispanics</a> in which he had floated, and found support for, the idea of granting “<a href="https://www.washingtonpost.com/blogs/right-turn/wp/2013/06/28/ted-cruzs-adversarial-relationship-with-facts/">work permits that do not allow citizenship</a>”—a proposal that Cruz now claims was just a ruse. When you deceive everyone, including voters and fellow conservatives, how can anyone trust you?</p><span> 


</span></div><span> 

</span><span> 

</span><div class="text-12 text parbase section"><span> 

</span><p><strong>5. He refuses to admit having changed his mind.</strong> In Thursday’s debate, Jeb Bush rebuked Rubio for abandoning his support of the 2013 immigration bill. Rubio pleaded, lamely, that he had done so because “the American people”—i.e., Republican voters—turned against the bill. But at least Rubio acknowledged his reversal. What distinguishes Cruz is his refusal to concede that he ever flirted with legalization. As Paul noted Thursday: “I was for legalization. I think, frankly, if you have border security, you can have legalization. So was Ted, but now he says it wasn’t so. That’s not true.” Another candidate on the stage, New Jersey Gov. Chris Christie, made the same point: “It’s perfectly legal in this country to change your mind. But when you’re a governor, you have to admit it. You can’t hide behind parliamentary tricks.”</p><span> 


</span></div><span> 

</span><div class="text-13 text parbase section"><span> 

</span><p>In his closing statement, Cruz put the issue squarely: “The central question in this race is trust.” Indeed it is. Cruz is running for president as the candidate you can believe in, the man who says what he means and does what he says. It’s a good slogan. It’s just not true of Cruz.</p><span> 


</span></div><span> 

</span><span> 
</span></div></body></html> 

回答

0

一种解决方案这是有点确定如下所示太为在CSS样式图像设定宽度。这个解决方案的唯一问题是图像被挤入显示屏。我宁愿那个用户能够为较大的图像滚动。有谁知道如何做到这一点?

String displayHtml = "<html>\n" + 
         "<head>\n" + 
         "<style>\n" + 
         "img {\n" + 
         " width: 100%;\n" + 
         "}\n" + 
         "</style>"+ 
         "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=yes\">\n"+ 
         "</head>\n" + 
         "<body>\n" + 
0

你在你的解决方案必须width:100%对图像本身,而是max-width:100%会更好,因为你要避免吹小图片全屏宽度。

无论如何,如果图像过宽(而不是切断或缩小图像),将图像水平滚动到水平滚动的解决方案是将其容器figure设置为max-width:100%,并确保它在必要时溢出。

figure.image.inline { 
 
    max-width:100%; 
 
    overflow-x:auto; 
 
}
<h1>Fox News is getting really good at spotting Ted Cruz’s lies.</h1> 
 
<div class="newbody body parsys"> 
 
    <div class="parbase image slate_image section"> 
 
    <div class=""> 
 
     <figure class="image inline "> 
 
     <img src_tag_name="src" title="Ted Cruz " alt="Ted Cruz " src="http://www.slate.com/content/dam/slate/articles/news_and_politics/politics/2016/01/160129_pol_ted-cruz_1024.jpg.CROP.promo-xlarge2.jpg"> 
 
     <figcaption class="caption"><span>Ted Cruz speaks during the Republican presidential debate sponsored by Fox News in Des Moines, Iowa, on Jan. 28, 2016.</span> 
 
     </figcaption> 
 
     <p class="credit">Jim Watson/Getty Images</p> 
 
     </figure> 
 
    </div> 
 
    </div> 
 
    <div class="text text-1 parbase section"> 
 
    <p>In Thursday night’s Republican presidential debate, moderator Megyn Kelly <a href="https://www.washingtonpost.com/news/the-fix/wp/2016/01/28/7th-republican-debate-transcript-annotated-who-said-what-and-what-it-meant/">grilled Sen. Ted Cruz</a> about his role in the Senate’s 2013 fight over immigration reform. As <strong><em>Slate</em></strong> recently explained, that fight is <a href="http://www.slate.com/articles/news_and_politics/politics/2016/01/the_definitive_timeline_of_what_ted_cruz_said_and_did_in_the_2013_immigration.html?wpsrc=sp_all_article_storypromo">an excellent episode to study</a> if you want to understand Cruz’s <a href="http://www.slate.com/articles/news_and_politics/cover_story/2016/01/ted_cruz_may_be_the_most_gifted_liar_ever_to_run_for_president.html">peculiar views about truth and deception</a>. By pressing Cruz about discrepancies between what he said then and what he says now, Kelly forced him to show the public, on live television, how he thinks about honesty. It wasn’t pretty.</p> 
 
    </div> 
 
    <section class="about-the-author fancy inline with-head"> 
 
    <div class="author-bio"> 
 
     <p>Will Saletan writes about politics, science, technology, and other stuff for <b><i>Slate</i></b>. He’s the author of <i><a target="_blank" href="http://rads.stackoverflow.com/amzn/click/0520243366">Bearing Right</a></i>.<a href="http://rads.stackoverflow.com/amzn/click/0520243366"><i><br></i></a> 
 
     </p> 
 
    </div> 
 
    </section> 
 
    <!-- /.about-the-author --> 
 
    <div class="text-2 text parbase section"> 
 
    <p>Kelly showed the debate audience four video clips. In the clips, taken from Cruz’s speeches during the 2013 fight, he earnestly appealed for a compromise that would allow undocumented immigrants to earn legal status—as prescribed by a bill the Senate was considering—but not citizenship. The key to the compromise was an amendment, offered by Cruz, that would have <a href="http://www.judiciary.senate.gov/imo/media/doc/Cruz3-(DAV13373).pdf">closed the path to citizenship</a>. Cruz now denies that he ever supported legalization. Here’s how he tried to explain the video clips, and what the exchange revealed about him.</p> 
 
    </div> 
 
    <div class="text-3 text parbase section"> 
 
    <p><strong>1. He lies.</strong> Kelly’s first clip, taken from Cruz’s speech in the Senate Judiciary Committee on May 9, 2013, showed him saying, “<a href="http://www.cruz.senate.gov/?p=press_release&amp;id=140">I don’t want this bill to be voted down</a>.” The second clip, taken from his speech to the committee on May 21, 2013, showed him saying, “<a href="http://www.cruz.senate.gov/?p=press_release&amp;id=128">If [my] amendment were to pass, the chances of this bill passing into law would increase dramatically</a>.” The third clip, taken from Cruz’s <a href="http://web.princeton.edu/sites/jmadison/calendar/flash/Cruz.html">remarks at Princeton University</a> on May 31, 2013, showed him saying: “I believe if the amendments I introduced were adopted, that the bill would pass. And my effort in introducing them was to find a solution that reflected common ground and that fixed the problem.”</p> 
 
    </div> 
 
    <div class="text-13 text parbase section"> 
 
    <p>In his closing statement, Cruz put the issue squarely: “The central question in this race is trust.” Indeed it is. Cruz is running for president as the candidate you can believe in, the man who says what he means and does what he says. It’s a good slogan. It’s just not true of Cruz.</p> 
 
    </div> 
 
</div>

(请注意,我缩短了HTML一点,这是我们感兴趣的CSS)。