问题
I'm trying to use dev branch of HoloEverywhere library to in my app. I understood that this is still during development but the demo seems to work okay so I give it a try.
I put android:theme="@style/Holo.Theme.Sherlock.Light" in the activity in my manifest. The structure of the activity is that it's using Fragment, one is a list and another is just Fragment. The ActionBar looks Holo just fine.
I turned my SherlockFragmentActivity into SActivity and Fragment into SFragment. Just as I checked in the accompanied demo app. I open dialog using this block of code in my SFragment.
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Work in Progress")
.setView(inflater.inflate(R.layout.extra_input))
.setIcon(R.drawable.icon);
builder.setPositiveButton("Positive", null);
builder.setNegativeButton("Negative", null);
builder.setNeutralButton("Neutral", null);
builder.show();
The dialog popped up looking like the OS's AlertDialog where EditText inside extra_input layout shown as Holo. ProgressDialog also display with OS's theme as well.
I believed this is me incorrectly implemented the library. The question is how to do it right?
Edit: Solved it, I need to use com.WazaBe.HoloEverywhere.app.AlertDialog instead of android.app.AlertDialog. Silly me.
回答1:
Solved it, I need to use com.WazaBe.HoloEverywhere.app.AlertDialog instead of android.app.AlertDialog. Silly me.
Answer added as recommended.
回答2:
android:theme="@style/Holo.Theme.Light"
or in style.xml
<style name="MyTheme" parent="Holo.Theme.Light">
</style>
来源:https://stackoverflow.com/questions/12481164/whats-a-correct-way-of-using-holoeverywhere