Reputation: 19956
I have a custom setting style, which runs well on the HTC, iphone but on the Samsung phone I get erros like: ERROR/AndroidRuntime(726): java.lang.RuntimeException: Binary XML file line #18: You must supply a layout_width attribute
.
my xml:
<style name="PreferencesTheme" parent="@android:style/Theme.Light">
<item name="android:windowBackground">@drawable/screen_background_light</item>
<item name="android:listSeparatorTextViewStyle">@style/ListSeparator</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item>
</style>
my style:
<activity android:name=".Setting.MainSettingActivity"
android:theme="@style/PreferencesTheme"
android:screenOrientation="portrait" ></activity>
this generates an error.so i modified my code. I added this code :
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.PreferencesTheme);
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);......
but still have same error. The activity is a SettingActivity, but on the htc iphone it is working correctly.
Upvotes: 2
Views: 313
Reputation: 524
Add:
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
To your custom TextView.ListSeparator style.
Upvotes: 1