2012-01-20 6 views
3

그냥하고 싶지만 어떻게해야할지 모르겠다. 이것은 수직 선형 레이아웃 일 것입니다. 나는 3 시간 동안 수색했으며 아직 유용한 것을 발견하지 못했다.절반 화면의 Android 웹보기

+0

체크 아웃이 질문 : http://stackoverflow.com/ 질문/4315332/how-to-create-two-views-in-android-that-use-50-height-each-one-is-small- – jorgenfb

+0

@ 토미 S : 안녕하세요. google.com을 열거 나 yahoo.com을 웹보기 (높이 = 200dp)로 말하면 처음 200dp를 보여줍니다. 빈 웹보기를 누른 다음 전체 scren에서 Google/야후 페이지를 엽니 다 ... 난 그냥 www.ya.com와 함께 노력, 그것은 나를 위해 ... 어떤 도움을 여기? – CoDe

+0

여기에 같은 ... 만약 내가 어떤 링크를 클릭하면 새로운 200pp 높이 webview .... 대신 열면 새로운 전체 화면 페이지를 엽니 다. – CoDe

답변

2

이전에 2 회의 webview를 사용했습니다. 나는 android : layout_weight를 1로 사용하여 웹 뷰와 스크린을 채웠다.

웹보기가 1 개 뿐이고 나머지 항목에는 선형 레이아웃을 사용하고 webview 및 선형 레이아웃 모두에 android : layout_weight = "1"을 설정하십시오.

0
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent"    
     android:weightSum="1"> 

웹 브라우저 버튼

button = (Button) findViewById(R.id.btn_webbrowser); 
button.setOnClickListener(new OnClickListener() 
{ 
    public void onClick(View arg0){ 
     Intent i = new 
     Intent(android.content.Intent.ACTION_VIEW, 
    Uri.parse(“http://www.amazon.com”)); 
startActivity(i); 
    } 
}); 
5

서로 동일 자녀보기의 가중치를 설정하면 균등하게 분할해야합니다

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <WebView 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" /> 

    <Space 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" /> 
</LinearLayout> 
+0

올바른 예를 들어 주셔서 감사합니다. 그러나 nithinreddy가 먼저 대답 했으므로 그 사람을 확인해야합니다. –