2012-04-25 1 views
1

두 webviews 함께 레이아웃을 할려고 해요. 내 문제는 내가 다른 웹뷰 위에 놓고 싶을 때이다. 그들은 서로 다른 입장에 처하게됩니다. 감사합니다!! ;)어떻게 두 webview (다른 webview 위의 하나) 넣을 수

나는 여기에 내 코드를 작성 :

<?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:id="@+id/webview2" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:autoLink="web" 
     android:scrollbars="none" 
     android:textColor="@android:color/black" /> 


<WebView 
    android:id="@+id/webview1" 
    android:layout_width="match_parent" 
    android:layout_height="570dp" 
    android:autoLink="web" 
    android:scrollbars="none" 
    android:textColor="@android:color/black" /> 

</LinearLayout> 
+0

왜 웹 뷰가 필요합니까? –

답변

0

는 FrameLayout이있는 webviews 모두 넣어보십시오. 그러면 견해가 쌓일 것입니다.

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


    <WebView 
     android:id="@+id/webview2" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:autoLink="web" 
     android:scrollbars="none" 
     android:textColor="@android:color/black" /> 


<WebView 
    android:id="@+id/webview1" 
    android:layout_width="match_parent" 
    android:layout_height="570dp" 
    android:autoLink="web" 
    android:scrollbars="none" 
    android:textColor="@android:color/black" /> 

</FrameLayout> 
+0

Agarwal, 훌륭한 답을 보내 주셔서 감사합니다!) – Christian

1

그 하나가 둘을 스택 할 수 있도록 그것을 은폐, 또는 당신이 요구하는지 여부, 즉, 상대방의 맨 위에 물리적 그래서이, 당신이 그들을 스택하려고 여부에 따라 달라집니다 것 같아요 하나는 상단에, 다른 하나는 하단으로 향하게합니다.

인 경우 RelativeLayout에 배치하고 android : layout_align .... 및 android : layout_above | 속성을 조합하여 사용하는 것이 좋습니다.

다음 속성을 아래의 layout_above | 속성을 변경하여 바꿀 수 있습니다.

<?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" 
android:orientation="vertical" > 


<WebView 
    android:id="@+id/webview2" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:autoLink="web" 
    android:scrollbars="none" 
    android:textColor="@android:color/black" /> 


<WebView 
android:id="@+id/webview1" 
android:layout_width="match_parent" 
android:layout_height="570dp" 
android:autoLink="web" 
android:scrollbars="none" 
android:textColor="@android:color/black" 
android:layout_below="@id/webview2" 
android:layout_alignParentLeft="true"/> 

</RelativeLayout> 
+0

감사의 rspython. 당신의 대답은 너무 좋습니다! ;) 나는 시험해 보러 간다! ;) – Christian

+0

당신의 문제를 정확하게 대답하는 것을 받아들이는 것을 잊지 마라. – rspython