بروز خطا
   [message]
اشتراک در سوال
رای ها
[dataList]
پرسش و پاسخ

انیمیشن

مدیریت گفتگو
amir Alu 12 سال پیش
آخرین تغییر: 11 سال پیش

سلام

ببخشید من یک سوال دارم.من 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>

با این انیمیشن این عکس زوم میشه میاد بالا و بعد بر میگرده سر جاش اما لبه های پایین عکس وقتی بزرگ میشن میرن زیر لایه ی پایینی و بعد بر میگردن. من می خوام روی لایه قرار بگبرن وقتی دارن زوم میشن.

حالا به نظر شما من باید چجوری عمل کنم؟

 

نظرات

amir Alu 11 سال پیش
سلام من 8 ماه پیش این سوال را مطرح کردم اما هنوز با چنین انیمیشن هایی مشکل دارم. کسی هست بتونه من رو راهنمایی کنه؟؟

پاسخ‌ها 4

Hajhosseini 11 سال پیش

خوب به لایه بالایی انیمیشن بدید!
اگر نمیتونید به لایه بالایی انیمیشن بدید حتما باید چک کنید که سایزی که زوم میکنید در این لایه بالا جا بشه. مثلا اگر پدینگ داره باید حذف یا کم بشه و از این قبیل کار ها.
باید تست کنید و به جواب برسید، این چیزی نیست که بدونه تست و Run کردن برنامه بشه پاسخ داد.

نظرات

amir Alu 11 سال پیش
دوست من، یزارین سوالم به یک شکل دیگه بپرسم. ما داخل یک Liner layout سه تا layout داریم حالا میخوام انیمیشنی داشته باشم که لایه ی پایینه بره زیر لایه دوم و بعد این مرحلاه دوتاشون برن زیر لایه اول و از بالا خارج بشن. اما بشکل معمول از پایین به بالا لایه ها روی هم قرار میگیرن . من میخوام یه جورایی اولویت بندی این لایه ها عوض بشه. اینجا باید چی کار کنم دوست عزیز
Astro 11 سال پیش

از متد زیر استفاده کنید:

.bringToFront();

نظرات

amir Alu 11 سال پیش
دوست من از این استفاده کردم اما هیچ تغییری حاصل نمیشه. یا شاید من دارم اشتباه ازش استفاده میکنم.
Hajhosseini 11 سال پیش

ایندفعه خیلی خوب منظور رو رسوندید.
کافیه به جای استفاده از LinearLayout  از RelativeLayout استفاده کنید.
جای LinearLayout ها رو برعکس کنید یعنی بالایی بیاد پایین
اینجا یک Trick وجود داره، زمانی که شما از RelativeLayout استفاده میکنید میتونید بگید این View رو کنار،زیر،بالا و ... اونیکی View قرار بده.
مکان بالاترین LinearLayout رو مشخص کنید
LinearLayout زیری (دومی) رو به این صورت ست کنید:

 android:layout_below="@+id/linear1"

نکته: حتما باید برای linear1 آیدی اختصاص داده باشید.
اگر از توی property ها بخواید این کار رو انجام بدید:

 Layout:AlignComponent

رو در قسمت top:bottom همون LinearLayout بالایی رو بذارید (linear1)
حالا دومی زیر اولی قرار میگیره ولی اولویت نمایش هنوز با اونیه که تو لیست لایه هاتون پایینه.
بعد از این کار سومی رو هم به زیر دومی قرار بدید.

نظرات

Hajhosseini 11 سال پیش
اگر مشکلتون حل شده، به صورت سوال یک حل شده اضافه کنید
amir Alu 11 سال پیش
بله دوست من مشکل حل شد ولی یک مشکل یا بهتر بگم سوال دیگه واسم پیش آمد
amir Alu 11 سال پیش

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 فضا رو اشغال کنه...؟

نظرات

Hajhosseini 11 سال پیش
هر FrameLayout رو در یک LinearLayout قرار بدید.
Hajhosseini 11 سال پیش
لطفا از صفحه ای که میخواید درست کنید عکس بگیرید و درج کنید، این توضیحاتی که دادید کامل نیست، کدتون هم نشانگر چیزی که میخواید درست کنید نیست.
amir Alu 11 سال پیش
درباره این که گفتید :(( هر FrameLayout رو در یک LinearLayout قرار بدید )) شدنی نیست اخه لایه های داخل RelativeLAyout نمیتونن Layout_weight بهشون داد.
amir Alu 11 سال پیش
عکسی ازش ندارم فقط یک flash ازش درست کردم واسه نمونه که میتونم واستون ایمیل کنم
Hajhosseini 11 سال پیش
امیر جان اگر مشکلت حل نشد برام ارسال کن تا کمکت کنم. ایمیل پ خ شد. ایمیل کردی در همین سایت پیام بده، چون ایمیل هام رو فقط روزی یکبار اول صبح چک میکنم

پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .