-1

Wie kann ich diese TextView auf dem Fragment aktivieren. Ich möchte, dass es auch dann statisch bleibt, wenn sich Fragmente voneinander entfernen. Ich habe kein Glück, es oben zu ermöglichen. Hier ist mein LayoutAktivieren Sie TextView oben Fragment

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.example.skwebviewapp.MainActivity"> 

    <fragment 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:id="@+id/mainFragment" 
     tools:layout="@layout/fragment_main" /> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="16dp" 
     android:id="@+id/textView" 
     android:text="@string/app_name"/> 
</LinearLayout> 

Antwort

0

Code unten versuchen,

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.example.skwebviewapp.MainActivity” 
    android:orientation=“vertical" 
    android:weightSum=“1.0"> 


    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height=“0dp” 
     android:layout_weight=“0.10" 
     android:id="@+id/textView" 
     android:text="@string/app_name”/> 


    <fragment 
     android:layout_width="match_parent" 
     android:layout_height=“0dp" 
     android:layout_weight=“0.90" 
     android:id="@+id/mainFragment" 
     tools:layout="@layout/fragment_main" /> 

</LinearLayout> 
0
You can try this with RelativeLayout. 

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


    <TextView 
     android:id="@+id/textView" 
     android:layout_width="match_parent" 
     android:layout_height="16dp" 
     android:text="@string/app_name" /> 

    <fragment xmlns:map="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/map_view_fargment" 
     android:name="com.google.android.gms.maps.MapFragment" 
     class="com.google.android.gms.maps.MapFragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="40dp" 
     /> 


</LinearLayout> 
+0

Dieses es im Inneren des Fragments legt. Ich möchte, dass es oben auf dem Fragment – ryhan112

+0

angezeigt wird Ich habe diesen Check jetzt bearbeitet. –

+0

ist jetzt behoben. Vielen Dank. – ryhan112

Verwandte Themen