2016-07-26 11 views
0

Ich habe eine XML-Datei mit dem Design meiner App. In diesem möchte ich eine TextView nach einem LinearLayout setzen. Aber wie kann ich das machen? Es zeigt es immer in meinen anderen Elementen an. Gibt es so etwas wie eine "margin_top_elemnt_by_id"? Ich hoffe du weißt was ich meine.Wie setze ich TextView nach einem anderen Element

Ich rede über post_view_maintext

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay"> 


</android.support.design.widget.AppBarLayout> 


<ImageView 
    android:layout_width="1440px" 
    android:layout_height="1000px" 
    android:id="@+id/post_view_photo" 
    android:transitionName="@string/transition_image"/> 



<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_vertical|start" 
    android:layout_margin="@dimen/fab_margin" 
    app:layout_anchor="@+id/post_view_photo" 
    android:src="@android:drawable/stat_notify_chat" 
    app:layout_anchorGravity="bottom|end" /> 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:background="@color/colorPrimary" 
    app:layout_anchor="@+id/post_view_photo" 
    app:layout_anchorGravity="bottom|start"> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/username_text" 
     android:layout_gravity="center_vertical|start" 
     app:layout_anchor="@+id/post_view_photo" 
     app:layout_anchorGravity="bottom|start" 
     android:textSize="25dp" 
     android:transitionName="@string/transition_username"/> 
</LinearLayout> 
<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 
    <View 
     android:layout_width="fill_parent" 
     android:layout_height="2dp" 
     android:background="#414141"/> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/post_view_maintext"/> 
</LinearLayout> 

Dank!

+0

können Sie Ihre Layout-XML-Datei hier posten? – Wilik

+0

Bitte geben Sie Ihren XML-Code – inkedTechie

+0

ja, ich postete es @Wilik – user6586661

Antwort

0

Verwenden Sie layout_below.

<LinearLayout 
...> 
    <ImageView 
     .../> 
    <TextView 
     ... 
     android:layout_toRightOf="@+id/imagevViewID" 
     android:layout_alignParentTop="true" 
    .../> 
    <TableLayout 
     android:layout_below="@+id/textviewID" 
     android:layout_toRightOf="@+id/imageViewID" 
    .../> 
</LinearLayout>