title: how to align an element to right in horizontal LinearLayout?
body: <p>I have a <code>LinearLayout</code> that contains a lot of <code>TextViews</code> and <code>ImageButtons</code>, I want to align some of these elements to right, i had a look at <a href="https://stackoverflow.com/questions/6992804/how-to-right-align-widget-in-horizontal-linear-layout-android">this</a> and <a href="https://stackoverflow.com/questions/9302799/placing-an-element-to-the-right-in-a-linear-layout-in-android">this</a> but i can't use their tips as i can't change the <code>orientation</code> and can't make <code>android.gravity:right</code> as i don't want to align all the elements to right, also i can't use nested layouts or but the desired elements into <code>RelativeLayout</code> because that shifts the rest of elements to the left and i want them at the center.</p>
  
  <p><strong>this is my code:</strong></p>
  
  <pre><code> &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="0dp"
              android:layout_weight="0.15"
              android:layout_marginTop="10dp"
              android:layout_gravity="center"
              android:gravity="center"
              android:background="@drawable/media_mediabar"
              android:orientation="horizontal" &gt;
  
              &lt;ImageButton
                  android:id="@+id/move_backward"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:adjustViewBounds="true"
                  android:background="@android:color/transparent"
                  android:clickable="true"
                  android:scaleType="centerInside"
                  android:src="@drawable/media_button_rewind"
                  android:layout_marginLeft="7dp"
                  android:layout_marginRight="7dp"
                  android:tag="released"/&gt;
  
             &lt;ImageButton
                  android:id="@+id/rmeote_mines"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center"
                  android:adjustViewBounds="true"
                  android:background="@android:color/transparent"
                  android:clickable="true"
                  android:scaleType="centerInside"
                  android:src="@drawable/remote_minus" /&gt;
  
  
            &lt;TextView 
                  android:id="@+id/remote_plus_minus"
                  android:text="0"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:textColor="@android:color/white"
                  android:layout_gravity="center"
                  android:layout_marginTop="15dp"
                  android:layout_marginBottom="15dp" /&gt;
              .
              .
              .&lt;!.. some other elements ..!&gt;
          &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>The desired result:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/giAVg.png" alt="enter image description here"></p>