Update ApiDemos for ActionBar
- use Gravity.START and Gravity.END Change-Id: Id2adac4c23ad2de2d04a36ef8195367aea63c66f
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
<!-- For android.media.audiofx.Visualizer -->
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
|
||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14" />
|
||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="16" />
|
||||
|
||||
<!-- We will request access to the camera, saying we require a camera
|
||||
of some sort but not one with autofocus capability. -->
|
||||
@@ -47,7 +47,8 @@
|
||||
<application android:name="ApiDemosApplication"
|
||||
android:label="@string/activity_sample_code"
|
||||
android:icon="@drawable/app_sample_code"
|
||||
android:hardwareAccelerated="true">
|
||||
android:hardwareAccelerated="true"
|
||||
android:supportsRtl="true">
|
||||
|
||||
<!-- This is how we can request a library but still allow the app
|
||||
to be installed if it doesn't exist. -->
|
||||
|
||||
@@ -93,18 +93,18 @@ public class ActionBarDisplayOptions extends Activity
|
||||
case R.id.cycle_custom_gravity:
|
||||
ActionBar.LayoutParams lp = (ActionBar.LayoutParams) mCustomView.getLayoutParams();
|
||||
int newGravity = 0;
|
||||
switch (lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||
case Gravity.LEFT:
|
||||
switch (lp.gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
|
||||
case Gravity.START:
|
||||
newGravity = Gravity.CENTER_HORIZONTAL;
|
||||
break;
|
||||
case Gravity.CENTER_HORIZONTAL:
|
||||
newGravity = Gravity.RIGHT;
|
||||
newGravity = Gravity.END;
|
||||
break;
|
||||
case Gravity.RIGHT:
|
||||
newGravity = Gravity.LEFT;
|
||||
case Gravity.END:
|
||||
newGravity = Gravity.START;
|
||||
break;
|
||||
}
|
||||
lp.gravity = lp.gravity & ~Gravity.HORIZONTAL_GRAVITY_MASK | newGravity;
|
||||
lp.gravity = lp.gravity & ~Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK | newGravity;
|
||||
bar.setCustomView(mCustomView, lp);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user