یه سوال در مورد ui
من سه تا لینیر لایوت دارم که داخل لینیر لایوت وسطی دوتا دکمه هستن می خوام این دوتا دکمه همیشه توی یه ارتفاع مشخصی از بالا و پایین صفحه به یه اندازه مشخصی نمایش داده شوند و با کوچیک بزرگ شدن صفحه نه اون ارتفاع تغییری کنه نه اندازه دکمه ها کوچیک بزرگ بشه لطفا راهنمایی کنید ؟
من با اون توضیحی که استاد دادن در مورد ارتفاع 0dp و وزن 1 امتحان کردم درست نمیشه اندازه ها تغییر می کنه
این کد لایه
<?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="match_parent"
android:orientation="vertical" android:background="@drawable/menu">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:orientation="vertical" android:layout_weight="0.50">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical" android:layout_weight="0.40">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.50"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="1dp"
android:layout_height="100dp"
android:src="@drawable/gallery" android:layout_weight="0.50"/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="1dp"
android:layout_height="100dp"
android:src="@drawable/ringtone" android:layout_weight="0.50"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.50"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/content" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/content" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical" android:layout_weight="0.10">
</LinearLayout>
</LinearLayout>
بیا اینم کد درستش (درستش این بود خودت تلاش میکردی ولی الان این کد را با کد خودت مقایسه کن اشکال های کارت را پیدا کن )
<?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="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip" android:layout_weight="0.5">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dip" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent" android:layout_weight="0.5">
<ImageView
android:id="@+id/imageView1"
android:layout_width="0dip"
android:layout_height="wrap_content" android:layout_weight="0.5"/>
<ImageView
android:id="@+id/ImageView01"
android:layout_width="0dip"
android:layout_height="wrap_content" android:layout_weight="0.5"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent" android:layout_weight="0.5">
<ImageView
android:id="@+id/ImageView02"
android:layout_width="0dip"
android:layout_height="wrap_content" android:layout_weight="0.5"/>
<ImageView
android:id="@+id/ImageView03"
android:layout_width="0dip"
android:layout_height="wrap_content" android:layout_weight="0.5"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip" android:layout_weight="0.5">
</LinearLayout>
</LinearLayout>
ببین ارتفاع کل صفحه را 100 در نظر بگیر
بعد اگه دوتا لایه داشتی که خواستی ارتفاع آنها یکی باشه باید وزن هر کدوم را بدی 0.50اگه خواستی یکی بزرگتر باشه یکی کوچکتر بزرگی را میدی 0.60 و کوچکی را میدی0.40
جمعش باید بشه 100
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .