I don't know what the standards are for Layout Naming on Android, but I can tell you that these names are not very good.
textView2
btn_distance_walked
textView3
none of these accurately describes what they do.
you should probably look for naming schemes on Google.
btn_distance_walked
doesn't tell us what the button is going to do. What is it going to do with the distance walked? It should be something like calculate_Distance
or calculateDistance
(my preferred naming scheme camelCasing)
Update:
I recently answered a question similar to this one and came up with a name scheme for buttons, action_ObjectActedUpon
this may be more specific to the naming issue in your code as well.
Your indentation seems to be off as well, it should look like this
<LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:orientation="vertical" > <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="0dip" android:layout_weight="1" android:text="" /> <Button android:id="@+id/btn_distance_walked" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:clickable="false" android:text="Distance walked = " /> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="0dip" android:layout_weight="1" android:text="" /> <Button android:id="@+id/btn_exersise_time" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:clickable="false" android:text="Exercise time = " /> <TextView android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="0dip" android:layout_weight="1" android:text="" /> <Button android:id="@+id/btn_average_speed" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:clickable="false" android:text="Average speed = " /> <TextView android:id="@+id/textView5" android:layout_width="wrap_content" android:layout_height="0dip" android:layout_weight="1" android:text="" /> <Button android:id="@+id/btn_calories_burned" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:clickable="false" android:text="Callories burned = " /> <TextView android:id="@+id/textView6" android:layout_width="wrap_content" android:layout_height="0dip" android:layout_weight="1" android:clickable="false" android:text="" /> <Button android:id="@+id/btn_back" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:text="Back" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="0dip" android:layout_weight="1" android:text="" /> </LinearLayout>
I just answered a similar question and I think that I should add a little bit of that answer to this one..
Another way that you can reduce clutter in the layout is to define some styles by creating an xml file in the res/values/
folder of your project and do this
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="MyStyle1"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">0dip</item> <item name="android:layout_weight">1</item> <!-- etc. --> </style> </resources>
and then in your Layout XML you add the style to the layout element like this
<LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:orientation="vertical" > <TextView style="@style/MyStyle1" android:id="@+id/textView2" android:text="" /> <Button style="@style/MyStyle1" android:id="@+id/btn_distance_walked" android:clickable="false" android:text="Distance walked = " /> <TextView style="@style/MyStyle1" android:id="@+id/textView3" android:text="" /> <Button style="@style/MyStyle1" android:id="@+id/btn_exersise_time" android:clickable="false" android:text="Exercise time = " /> <TextView style="@style/MyStyle1" android:id="@+id/textView4" android:text="" /> <Button style="@style/MyStyle1" android:id="@+id/btn_average_speed" android:clickable="false" android:text="Average speed = " /> <TextView style="@style/MyStyle1" android:id="@+id/textView5" android:text="" /> <Button style="@style/MyStyle1" android:id="@+id/btn_calories_burned" android:clickable="false" android:text="Callories burned = " /> <TextView style="@style/MyStyle1" android:id="@+id/textView6" android:clickable="false" android:text="" /> <Button style="@style/MyStyle1" android:id="@+id/btn_back" android:text="Back" /> <TextView style="@style/MyStyle1" android:id="@+id/textView1" android:text="" /> </LinearLayout>
note that I am not a professional, but I found Styles and Themes from doing a quick search for styles.xml android example
Don't forget about Developer.Android.com it can be very helpful.