انیمیشن
سلام
ببخشید من یک سوال دارم.من 2تا لایه ی LinearLayout دارم که داخل هر کدوم 2 تا ImageView هست و واسه ی یکی از این Imageview ها انیمیشنی ساختم به صورت زیر
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="100"
android:shareInterpolator="true"
>
<scale
android:interpolator="@android:anim/bounce_interpolator"
android:fromXScale="0.8"
android:toXScale="2.2"
android:fromYScale="0.8"
android:toYScale="2.2"
android:duration="100"
android:fillAfter="false"
android:repeatCount="3"
android:repeatMode="reverse"
android:pivotX="50%p"
android:pivotY="25%p"/>
<alpha
android:fromAlpha="0"
android:toAlpha="1"
android:duration="50"
android:interpolator="@android:anim/overshoot_interpolator"
/>
</set>
با این انیمیشن این عکس زوم میشه میاد بالا و بعد بر میگرده سر جاش اما لبه های پایین عکس وقتی بزرگ میشن میرن زیر لایه ی پایینی و بعد بر میگردن. من می خوام روی لایه قرار بگبرن وقتی دارن زوم میشن.
حالا به نظر شما من باید چجوری عمل کنم؟
خوب به لایه بالایی انیمیشن بدید!
اگر نمیتونید به لایه بالایی انیمیشن بدید حتما باید چک کنید که سایزی که زوم میکنید در این لایه بالا جا بشه. مثلا اگر پدینگ داره باید حذف یا کم بشه و از این قبیل کار ها.
باید تست کنید و به جواب برسید، این چیزی نیست که بدونه تست و Run کردن برنامه بشه پاسخ داد.
ایندفعه خیلی خوب منظور رو رسوندید.
کافیه به جای استفاده از LinearLayout از RelativeLayout استفاده کنید.
جای LinearLayout ها رو برعکس کنید یعنی بالایی بیاد پایین
اینجا یک Trick وجود داره، زمانی که شما از RelativeLayout استفاده میکنید میتونید بگید این View رو کنار،زیر،بالا و ... اونیکی View قرار بده.
مکان بالاترین LinearLayout رو مشخص کنید
LinearLayout زیری (دومی) رو به این صورت ست کنید:
android:layout_below="@+id/linear1"
نکته: حتما باید برای linear1 آیدی اختصاص داده باشید.
اگر از توی property ها بخواید این کار رو انجام بدید:
Layout:AlignComponent
رو در قسمت top:bottom همون LinearLayout بالایی رو بذارید (linear1)
حالا دومی زیر اولی قرار میگیره ولی اولویت نمایش هنوز با اونیه که تو لیست لایه هاتون پایینه.
بعد از این کار سومی رو هم به زیر دومی قرار بدید.
xml را بصورت زیر نوشتم مشکلم حل شد
<RelativeLayout
android:id="@+id/viewParts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:visibility="visible"
>
<FrameLayout
android:id="@+id/aboutUs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#C06C84"
android:layout_below="@+id/webSite"
android:layout_alignParentBottom="true"
>
<TextView
android:id="@+id/imageView2"
android:layout_width="105dip"
android:layout_height="105dip"
android:layout_gravity="center_vertical"
android:layout_marginBottom="16dip"
android:layout_marginLeft="56dip"
android:layout_marginRight="16dip"
android:layout_marginTop="16dip"
android:background="@drawable/khat" />
<LinearLayout
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="19">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#ffffff">
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="180dip"
android:layout_height="96dip"
android:layout_gravity="center_vertical|right">
<TextView
android:id="@+id/textView3"
android:layout_width="8dip"
android:layout_height="match_parent"
android:layout_marginBottom="12dip"
android:layout_marginTop="12dip"
android:background="#00FFFF" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="6dip"
android:gravity="left"
android:text="درباره طراح\nو سازنده"
android:textColor="#ffffff"
android:textSize="30sp" />
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/webSite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#6C5B7B"
android:layout_below="@+id/aboutUni">
<TextView
android:id="@+id/imageView2"
android:layout_width="105dip"
android:layout_height="105dip"
android:layout_gravity="center_vertical"
android:layout_marginBottom="16dip"
android:layout_marginLeft="56dip"
android:layout_marginRight="16dip"
android:layout_marginTop="16dip"
android:background="@drawable/web1" />
<LinearLayout
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="19">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#ffffff">
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="180dip"
android:layout_height="96dip"
android:layout_gravity="center_vertical|right"
>
<TextView
android:id="@+id/textView3"
android:layout_width="8dip"
android:layout_height="match_parent"
android:layout_marginBottom="12dip"
android:layout_marginTop="12dip"
android:background="#F67281" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="6dip" android:gravity="left"
android:text="وب سایت\nدانشگاه"
android:textColor="#ffffff"
android:textSize="32sp" />
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/aboutUni"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#355C7D"
android:layout_alignParentTop="true" >
<TextView
android:id="@+id/imageView2"
android:layout_width="105dip"
android:layout_height="105dip"
android:layout_gravity="center_vertical"
android:layout_marginBottom="16dip"
android:layout_marginLeft="56dip"
android:layout_marginRight="16dip"
android:layout_marginTop="16dip"
android:background="@drawable/uni1" />
<LinearLayout
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="19" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#ffffff" >
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="180dip"
android:layout_height="96dip"
android:layout_gravity="center_vertical|right" >
<TextView
android:id="@+id/textView3"
android:layout_width="8dip"
android:layout_height="match_parent"
android:layout_marginBottom="12dip"
android:layout_marginTop="12dip"
android:background="#FEB594" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="6dip"
android:gravity="left"
android:text="معرفی\nدانشگاه"
android:textColor="#ffffff"
android:textSize="32sp" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>
ولی یک سوال دیگه پیش آمد. چطور تنظیم کنم که بتونم به frameLayout ها وزن بدم که دقیقا هر کدوم 1/3 فضا رو اشغال کنه...؟
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .