Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Elevationで影が思ったように出ないとき

ninjinkun
January 15, 2015

 Elevationで影が思ったように出ないとき

Android 5.0のelevationのバッドノウハウ集です

ninjinkun

January 15, 2015
Tweet

More Decks by ninjinkun

Other Decks in Programming

Transcript

  1. ͳΜ͔Ө͕ग़ͳ͍ w #VUUPOʹFMFWBUJPO͕౰ͨΒͳ͍ w TUBUF-JTU"OJNBUPS͕FMFWBUJPOΛ্ॻ͖ͯ͠Δ w σϑΥϧτͩͱ#VUUPO͸EQු͍ͯΔ IUUQRJJUBDPN(FTZVUBQPJUFNTGGCGFF <item android:state_enabled="true">

    <set> <objectAnimator android:propertyName="translationZ" android:duration="@integer/button_pressed_animation_duration" android:valueTo="0" android:startDelay="@integer/button_pressed_animation_delay" android:valueType="floatType"/> <objectAnimator android:propertyName="elevation" android:duration="0" android:valueTo="@dimen/button_elevation_material" android:valueType="floatType" /> </set> </item> ͓લ͔ʂ TUBUF-JTU"OJNBUPSl!OVMMzʹ ͢Δͱ೚ҙͷߴ͞ʹͰ͖Δ
  2. &MFWBUJPOWT7JFX֊૚ w 7JFX͕ಉ͡FMFWBUJPOͳΒӨ͸ͳ ͘ͳΔ <LinearLayout android:layout_width="wrap_content" android:layout_height=“wrap_content" android:orientation="vertical"> <TextView android:elevation="8dp"

    android:padding="4dp" android:gravity=“center" android:layout_width="wrap_content" android:layout_height="@dimen/grid_size" android:background="@android:color/holo_green_dark" /> <TextView android:elevation="8dp" android:padding="4dp" android:gravity="center" android:layout_width="wrap_content" android:layout_height="@dimen/grid_size" android:background="@android:color/holo_blue_dark" /> </LinearLayout>
  3. &MFWBUJPOWT7JFX֊૚ w 7JFX֊૚͕ҧ͏ͱಉ͡FMFWBUJPOͰ΋ Ө͕ண͘ <LinearLayout android:layout_width="wrap_content" android:layout_height=“wrap_content" android:orientation="vertical"> <TextView android:elevation="8dp"

    android:padding="4dp" android:gravity=“center" android:layout_width="wrap_content" android:layout_height="@dimen/grid_size" android:background="@android:color/holo_green_dark" /> <LinearLayout android:layout_width="wrap_content" android:layout_height=“wrap_content" android:orientation="vertical"> <TextView android:elevation="8dp" android:padding="4dp" android:gravity="center" android:layout_width="wrap_content" android:layout_height="@dimen/grid_size" android:background="@android:color/holo_blue_dark" /> </LinearLayout> </LinearLayout>
  4. "DUJPO#BSͷλϒͰӨ͕ग़ͳ͍ w /"7*("5*0/@.0%&@5"#4ͰӨ ͕ग़ͳ͍ w ͦ΋ͦ΋͔Β%FQSFDBUFE w Ͳ͏ͯ͠΋࢖͍͚ͨΕ͹ແཧ໼ཧ
 ग़͢͜ͱ͸Մೳ ActionBarContainer

    container = 
 (ActionBarContainer) getWindow().findViewById(R.id.action_bar_container); container.setBackgroundColor(getResources().getColor(R.color.actionbar_background));