Android_Profile Screen - smukov/AvI GitHub Wiki
Adding My Profile Screen
In this section we'll add a My Profile Screen to our application, and we'll only focus on the layout part, we won't go into implementation of background logic.
My Profile Screen Layout
On My Profile Screen I want to add a picture of the user, his name, occupation, education, interests, what the user is knowledgeable in, and what are his current goals. I want to show the same information both in My Profile Screen and in Contact Screen, with only difference that the Contact Screen is not editable, since it's showing information of other users.
Implementation
I'm going to use LinearLayout
with vertical
orientation to stack all my views within this layout. The process is pretty straightforward, and the code is rather long, so I won't be showing it here, rather, you can follow this link to see the full source code.
As I already said, the difference between My Profile and Contact screen is only that the Contact screen is not editable, so I'm going to use this to quickly create the Contact Layout as well. Again, I'm not pasting any code, but you can see what I did in this commit or in this layout file. The process of adding new screens is already described here.
android:hint
The only thing I'd point out in this post is the android:hint
attribute. This is used to specify a text value that will be displayed in an empty EditText
view, and will disappear after you start typing. This is a pretty useful feature that can help users understand what is expected of them, and what's the purpose of a specific EditText
.
Conclusion
Creating the two layouts for My Profile and Contact screens was rather straightforward, especially after I previously created the reusable layout that I was able to simply include in these new layouts. Below you can see the look of the My Profile and Contact screens, respectively.