2017-03-26 2 views
2

左と右に2つの画像を表示し、それらの間に左の画像と少し離れたところにテキストビューを入れたいが、 。他の子供の間でもっとも左と真ん中に子供を揃えるのが難しい

<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="70dp" 
     android:orientation="horizontal"> 

    <ImageView 
      android:id="@+id/image_of_services" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="5dp" 
      android:src="@drawable/ic_menu_camera" /> 

     <TextView 
      android:id="@+id/name_of_services" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="30dp" 
      android:text="adasdsad" 
    android:layout_weight="8" 
      android:textSize="20sp" /> 

     <ImageView 
      android:id="@+id/image_arrow" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="right" 
      android:layout_weight="2" 
      android:src="@drawable/ic_menu_camera" /> 
    </LinearLayout> 
+0

を必要に応じて、それはあなたの実際の必要性だったか完全に働きましたか? – g7pro

答えて

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


    <ImageView 
     android:id="@+id/image_of_services" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_marginLeft="10dp" 
     android:src="@drawable/ic_menu_camera" /> 

    <TextView 
     android:id="@+id/name_of_services" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="30dp" 
     android:layout_weight="1" 
     android:text="adasdsad" 
     android:textSize="20sp" /> 

    <ImageView 
     android:id="@+id/image_arrow" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="20dp" 
     android:src="@drawable/ic_menu_gallery" /> 

</LinearLayout> 

私は、コードを編集していると私は

1
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:weightSum="10" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

    <ImageView 
     android:id="@+id/image_of_services" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="5dp" 

     android:layout_weight="2" 
     android:src="@drawable/ic_menu_camera" /> 

    <TextView 
     android:id="@+id/name_of_services" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="adasdsad" 
     android:layout_weight="6" 
     android:textSize="20sp" /> 

    <ImageView 
     android:id="@+id/image_arrow" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="right" 
     android:layout_weight="2" 
     android:src="@drawable/ic_menu_camera" /> 
</LinearLayout>` 
+0

私はそれが動作しませんでした....しかし、とにかく感謝 –

関連する問題