0

I'm having problems with how items appear in the Android Studio Designer and my phone. The first problem is that widgets & fragments appear differently in the designer/emulator than on my phone. I have tried lowering the resolution in the designer to test other device resolutions but it still appears differently on my phone despite the resolutions being relatively the same.

Designer view:

https://i.stack.imgur.com/PujBV.png

HTC Desire 510:

https://i.stack.imgur.com/xVO1o.png

The designer view is using the Nexus S's resolution which is smaller than my phone's resolution, yet the items still appear differently. I am in fact using RelativeLayout.

The other problem is that if you noticed, the button and text appears differently in the designer/emulator than on my phone. When I click the button on my phone, there is no button down effect, yet in the emulator, the effect is present. This is problematic because I want my designs to be consistent across all devices.

Cyogenos
  • 3,509
  • 3
  • 15
  • 14
  • You need to check logcat to see why the button down function didn't get called. – Stephen Lin Mar 12 '15 at 02:35
  • Oh no it did get called, the problem is that the effect which appears when you click on the button does not happen on my phone. In fact, the button appears differently on my phone as you can see from the images. – Cyogenos Mar 12 '15 at 02:48

1 Answers1

0

The designer/emulator use the official frameworks of android, while Some mobile device manufacturer may modify some appearance of widgets in frameworks, so the "View" you see in designer may be different from what you see in real devices, even different devices have different appearance for some widgets.

Support the real device have not modified widgets appearance in frameworks, then you can expect them have the same appearance with designer/emulator. One thing to notice, Android studio designer renders "Views" using some theme, you can specify the theme using "tools:context" attribute or select one in options, for example:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="horizontal"
          tools:context=".MainActivity"/>

enter image description here

Terry Liu
  • 601
  • 5
  • 8