Question

I am having an issue making an activity looking the same as another one.

I am giving both activities Theme_DeviceDefault as the theme. The PreferenceActivity looks exactly how I want it to, but my other activity doesn't look anything like it, font is way too small, font is not the same color, there's no text padding.

Any ideas what I'm doing wrong?

This looks like what I want

This doesn't look at all like the previous one

This is my xml for the other activity

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TextView
        android:id="@+id/id1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="My App" />

    <TextView
        android:id="@+id/id2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="More text" />

    <TextView
        android:id="@+id/id3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="someMethod"               
        android:clickable="true"
        android:text="Action" />

</LinearLayout>
Was it helpful?

Solution

I suppose that you are using android.preference.PreferenceActivity, that is not only a simple activity, but is an activity created specially for the user's preferences. So it has a particular style already setted. Instead your activity has the default style (based on the different android version).

As you can see here, this is the PreferencesActivity hierarchy:

           ↳    android.app.Activity
               ↳    android.app.ListActivity
                   ↳    android.preference.PreferenceActivity

Create and set your style if you don't like the default one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top