Giao diện android

Chào mọi người, mình muốn làm cho 3 cái button : HOT, NEW, NEAR nó nằm vị trí như trong hình nhưng ko biết làm sao, nếu xét layout below hoặc above thì nó bị sụt xuống và mất luôn, làm sao cho nó nằm cố định trên như vậy dc ạ. Vì mình thiết kế thì nó bị ẩn đi bởi mấy cái hình trên và mặc dù đặt gravity: bottom nhưng nó ko nằm ở bottom
đây là code:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_weight="100dp"
    android:gravity="center|bottom"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/button1"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|center"
        android:text="1" />

    <Button
        android:id="@+id/button2"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="145dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|center"
        android:textColor="@color/cardview_dark_background"
        android:text="button 2" />

    <Button
        android:id="@+id/button3"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|center"
        android:text="3" />
</LinearLayout>

Có nhiều cách để làm điều này, bạn có thể xem tại đây:

1 Like

Chắc cái view phía trên bạn thiếu ScrollView (nên khi View phía trên dài quá, cái SnackBar bị đẩy xuống)

1 Like

phải dùng scrollview ạ? tại mình dùng RelativeLayout trong đó có 2 cái cardView à?

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?