0
我想將ImageViews拉伸到parentlayout。我已經用marginleft命令完成了它。但對於不同的屏幕它沒有用處。在一個佈局中拉伸幾個視圖
我不想用java改變邊距。我想爲所有屏幕伸展這些Imageviews。他們對此有任何指令嗎?
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.berkay.uumobil.MainActivity">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1">
<LinearLayout
android:id="@+id/menuLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@color/colorPrimary"
android:orientation="horizontal">
<ImageView
android:id="@+id/menu_home"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
app:srcCompat="@drawable/home_button" />
<ImageView
android:id="@+id/menu_marks"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:layout_marginLeft="30dp"
app:srcCompat="@drawable/not_karti_button" />
<ImageView
android:id="@+id/menu_calender"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="30dp"
app:srcCompat="@drawable/takvim_button" />
<ImageView
android:id="@+id/menu_timetable"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="30dp"
app:srcCompat="@drawable/dersprog_button" />
<ImageView
android:id="@+id/menu_foodlist"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="30dp"
app:srcCompat="@drawable/yemek_button" />
<ImageView
android:id="@+id/menu_logout"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="30dp"
app:srcCompat="@drawable/logout_button" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/menuLayout"
android:layout_alignParentTop="true">
</FrameLayout>
</RelativeLayout>
In this picture ImageViews are not stretched
In this picture ImageViews are stretched via marginLeft
我想看到像第二我的應用程序,而無需使用marginleft。
然後用重量線性佈局。 –