In the activity_main.xml is used
- ScrollView
- LinearLayout
- RelativeLayout
For TextView, RadioGroups, RadioButtons, EditText and Buttons.
App was running normal till resetButton added. After this app runs but resetButton is invisible.
I think there is a mistake between layouts maybe I should use another combination of layouts, I don't know.
Thanks for any help!
**activity_layout.xml**
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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"
tools:context="com.allyouask.hungryforhistory.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="#+id/welcomeMessage"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="#style/welcomeMessage"
android:fontFamily="sans-serif-light"
android:text="Welcome to Hungry For History!\n Let's get started!"
android:layout_centerHorizontal="true"/>
<TextView
android:id="#+id/inputQuestion"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="#style/QuestionsStyle"
android:text=" Who was the king of the Gods in Ancient Greece:"
android:layout_below="#+id/welcomeMessage"/>
<EditText
android:id="#+id/inputAnswer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/inputQuestion"/>
<TextView
android:id="#+id/firstQuestion"
style="#style/QuestionsStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/inputAnswer"
android:paddingLeft="5dp"
android:text="Who was born in Ancient City Stagira, Greece?"/>
<RadioGroup
android:id="#+id/firstGroupRadioButtons"
android:layout_below="#+id/firstQuestion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"/>
<RadioButton
android:id="#+id/firstLeftRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/firstGroupRadioButtons"
android:text="Aristotle"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:id="#+id/firstRightRadioButton"
android:layout_below="#+id/firstGroupRadioButtons"
style="#style/RadioButtonStyle"
android:layout_toRightOf="#+id/firstLeftRadioButton"
android:text="Pythagoras"
android:onClick="onRadioButtonClicked"/>
<TextView
android:id="#+id/secondQuestion"
style="#style/QuestionsStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/firstLeftRadioButton"
android:paddingLeft="5dp"
android:text="Who said in his last speech:With malice toward none;...let us strive on to finish the work we are in;to bind up the nation's wounds;into care for him who shall have borne the battle and for his widow and his orphans?"/>
<RadioGroup
android:id="#+id/secondGroupRadioButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/secondQuestion"
android:orientation="horizontal"/>
<RadioButton
android:id="#+id/secondLeftRadioButton"
style="#style/RadioButtonStyle"
android:layout_alignParentLeft="true"
android:layout_below="#+id/secondGroupRadioButtons"
android:text="William McKinley"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:id="#+id/secondRightRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/secondGroupRadioButtons"
android:layout_toRightOf="#+id/secondLeftRadioButton"
android:text="Abraham Lincoln"
android:onClick="onRadioButtonClicked"/>
<TextView
android:id="#+id/thirdQuestion"
style="#style/QuestionsStyle"
android:layout_below="#+id/secondLeftRadioButton"
android:paddingLeft="5dp"
android:text="Where the An Lushan Rebellion took place?"/>
<RadioGroup
android:id="#+id/thirdGroupRadioButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/thirdQuestion"
android:orientation="horizontal"/>
<RadioButton
android:id="#+id/thirdLeftRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/thirdGroupRadioButtons"
android:text="China"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:id="#+id/thirdRightRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/thirdGroupRadioButtons"
android:layout_toRightOf="#+id/thirdLeftRadioButton"
android:text="Thailand"
android:onClick="onRadioButtonClicked"/>
<TextView
android:id="#+id/fourthQuestion"
style="#style/QuestionsStyle"
android:layout_below="#+id/thirdLeftRadioButton"
android:text="Who was the most famous exemplar of absolute monarchy in France?"/>
<RadioGroup
android:id="#+id/fourthGroupRadioButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/fourthQuestion"
android:orientation="horizontal"/>
<RadioButton
android:id="#+id/fourthLeftRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/fourthGroupRadioButtons"
android:text="Louis XIV"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:id="#+id/fourthRightCheckBox"
style="#style/RadioButtonStyle"
android:layout_below="#+id/fourthGroupRadioButtons"
android:layout_toRightOf="#+id/fourthLeftRadioButton"
android:text="Michael I"
android:onClick="onRadioButtonClicked"/>
<TextView
android:id="#+id/fifthQuestion"
style="#style/QuestionsStyle"
android:layout_below="#+id/fourthLeftRadioButton"
android:text="When Alexander The Great lived?"/>
<RadioGroup
android:id="#+id/fifthGroupRadioButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/fifthQuestion"
android:orientation="horizontal"/>
<RadioButton
android:id="#+id/fifthLeftRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/fifthGroupRadioButtons"
android:text="330-323 BC"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:id="#+id/fifthRightRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/fifthGroupRadioButtons"
android:layout_toRightOf="#+id/fifthLeftRadioButton"
android:text="336-323 BC"
android:onClick="onRadioButtonClicked"/>
<TextView
android:id="#+id/sixthQuestion"
style="#style/QuestionsStyle"
android:layout_below="#+id/fifthLeftRadioButton"
android:text="Where Albert Einstein studied?"/>
<RadioGroup
android:id="#+id/sixthGroupRadioButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/sixthQuestion"
android:orientation="horizontal"/>
<RadioButton
android:id="#+id/sixthLeftRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/sixthGroupRadioButtons"
android:text="University of Zurich"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:id="#+id/sixthRightRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/sixthGroupRadioButtons"
android:layout_toRightOf="#+id/sixthLeftRadioButton"
android:text="University of Germany"
android:onClick="onRadioButtonClicked"/>
<TextView
android:id="#+id/seventhQuestion"
style="#style/QuestionsStyle"
android:layout_below="#+id/sixthLeftRadioButton"
android:text="What was the main interest of Democritus?"/>
<RadioGroup
android:id="#+id/seventhGroupRadioButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/seventhQuestion"
android:orientation="horizontal">
<RadioButton
android:id="#+id/seventhLeftRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/seventhGroupRadioButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mathematics-Astronomy"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:id="#+id/seventhRightRadioButton"
style="#style/RadioButtonStyle"
android:layout_below="#+id/seventhGroupRadioButtons"
android:layout_toRightOf="#+id/seventhLeftRadioButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Philosophy-Psychology"
android:onClick="onRadioButtonClicked"/>
</RadioGroup>
<Button
android:id="#+id/submitButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/backgroundColor"
android:layout_marginBottom="4dp"
android:text="Submit"
android:textColor="#color/textColor"
android:onClick="OnClick"
android:layout_alignParentBottom="true"/>
<Button
android:id="#+id/resetButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginBottom="3dp"
android:onClick="OnClick"
android:background="#color/backgroundResetColor"
android:textColor="#color/textColor"
android:text="Reset"
android:textAllCaps="true"
android:layout_below="#+id/submitButton"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#FFC107</item>
<item name="colorPrimaryDark">#E65100</item>
<item name="colorAccent">#EF6C00</item>
</style>
<style name="welcomeMessage">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_centerHorizontal">true</item>
<item name="android:paddingTop">10dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">#EF6C00</item>
</style>
<style name="QuestionsStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingLeft">6dp</item>
<item name="android:paddingRight">6dp</item>
<item name="android:textSize">15sp</item>
<item name="android:textStyle">italic</item>
<item name="android:textColor">#000000</item>
</style>
<style name="RadioButtonStyle">
<item name="android:textSize">14sp</item>
<item name="android:textColor">#FFAB00</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textStyle">bold</item>
<item name="android:paddingLeft">6dp</item>
</style>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#FFC107</color>
<color name="colorPrimaryDark">#E65100</color>
<color name="colorAccent">#EF6C00</color>
<!-- Button Colors -->
<color name="backgroundColor">#EF6C00</color>
<color name="backgroundResetColor">#FB8C00</color>
<color name="textColor">#FFFFFF</color>
</resources>
</resources>
Using your code I get this Output. Are you want this or something else.
I have put your code inside this
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
// your code here..
</RelativeLayout>
</ScrollView>
'
UpDate :
you have to give id this way.. and check layout_below property to both Button.
<Button
android:id="#+id/submitButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/seventhGroupRadioButtons"
android:layout_marginBottom="4dp"
android:layout_marginTop="10dp"
android:background="#android:color/black"
android:onClick="OnClick"
android:text="Submit"
android:textColor="#android:color/white" />
<Button
android:id="#+id/resetButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/submitButton"
android:layout_marginBottom="3dp"
android:layout_marginTop="2dp"
android:onClick="OnClick"
android:text="Reset"
android:textAllCaps="true"
android:textColor="#android:color/black" />
Related
My XML CODE:-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<TextView
android:id="#+id/tvCollege"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="NGF\nCOLLEGE"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/tvNameTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:layout_toLeftOf="#id/imgBarTeachers"
android:layout_toRightOf="#id/tvCollege"
android:gravity="center"
android:textAllCaps="true"
android:textColor="#color/colorAccent"
android:textSize="18sp" />
<ImageView
android:id="#+id/imgBarTeachers"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_menu" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="20dp"
android:paddingRight="10dp"
android:paddingBottom="20dp">
<ImageView
android:layout_width="96dp"
android:layout_height="96dp"
android:padding="10dp"
android:src="#drawable/ic_teachers" />
<View
android:layout_width="1dp"
android:layout_height="76dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="9dp"
android:layout_marginRight="9dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/tvSubjectTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAllCaps="true"
android:textColor="#414141"
android:textSize="18sp" />
<TextView
android:id="#+id/tvMobileTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp" />
<TextView
android:id="#+id/tvMailTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerViewMenuTeacher"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none" />
</LinearLayout>
My app is running perfectly but when I'm running my app in android 7.0 it's showing me this error.
Error what I'm getting:
Process: com.ngfcet.ngfconnection, PID: 21684
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ngfcet.ngfconnection/com.ngfcet.ngfconnection.activities.TeacherActivity}: android.view.InflateException: Binary XML file line #21: Binary XML file line #21: Error inflating class TextView
I think this error is also can formed by firebase because
which textview have +id/tvCollege is not showing any error because I'm not putting any data in it through firebase
Theme for whole application
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">#android:color/white</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">#android:color/white</item>d
<item name="android:fontFamily">sans-serif-medium</item>
</style>
</resources>
It's too simple. I have removed
<item name="android:fontFamily">sans-serif-medium</item>
from styles.xml
Thanks! It's working perfect now
its a simple linear layout with 1 ImageView and 6 TextViews and a ScrollView but TextViews are appearing at the end of the screen and not below ImageView. I have tried editing my dp values in styles.xml but still not working please have a look!!
I have also tried editing my ImageView tags but still not working and don't know why TextViews are appearing at the end of the screen and if I remove ScrollView the texts are not visible.
Layout code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#000000"
tools:context="com.example.stan.sportbusinesscard.MainActivity">
<ImageView
android:scaleType="fitStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="#string/photo_description"
android:src="#drawable/photo"
android:id="#+id/image"/>
<TextView
style="#style/TitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/title" />
<TextView
style="#style/LightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/text1"/>
<TextView
style="#style/TitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/where" />
<TextView
style="#style/LightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/address"
android:autoLink="map"/>
<TextView
style="#style/TitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/when" />
<TextView
style="#style/LightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/dateOf" />
</LinearLayout>
</ScrollView>
Styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="LightText" parent="AppTheme">
<!-- Customize your theme here. -->
<item name="android:paddingLeft">18dp</item>
<item name="android:paddingRight">18dp</item>
<item name="android:textColor">#aaaaaa</item>
</style>
<style name="TitleText" parent="AppTheme">
<!-- Customize your theme here. -->
<item name="android:paddingLeft">18dp</item>
<item name="android:paddingRight">18dp</item>
<item name="android:paddingTop">20dp</item>
<item name="android:textSize">18sp</item>
<item name="android:textColor">#FFD700</item>
</style>
</resources>
You ImageView hight is wrap_content this the reason why your textview are at the bottom of your screen
Try this set static height to your ImageView
<ImageView
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="150dp"
android:contentDescription="#string/photo_description"
android:src="#drawable/photo"
android:id="#+id/image"/>
Try this!
In your <ImageView> scaleType is android:scaleType="fitStart" change it to android:scaleType="fitXY"
Don't use Scrollview as parent view and add android:adjustViewBounds="true" to Imageview for fit.
<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">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#000000"
>
<ImageView
android:scaleType="fitStart"
android:layout_width="match_parent"
android:adjustViewBounds="true"
android:layout_height="wrap_content"
android:contentDescription="#string/photo_description"
android:src="#drawable/photo"
android:id="#+id/image"/>
<TextView
style="#style/TitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/title" />
<TextView
style="#style/LightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/text1"/>
<TextView
style="#style/TitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/where" />
<TextView
style="#style/LightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/address"
android:autoLink="map"/>
<TextView
style="#style/TitleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/when" />
<TextView
style="#style/LightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/dateOf" />
</LinearLayout>
</ScrollView>
</LinearLayout>
I am trying to make the back button on the toolbar black, but I can't find a way. For some reason I don't have toolBar in my xml file, so there is no way to change the color for me. Please let me know if there is another way.
I have the primaryColor white, but the back button is also white.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="colorControlNormal">#color/colorPrimaryDark</item>
<item name="actionMenuTextColor">#color/colorPrimaryDark</item>
</style>
This is my xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<Space
android:layout_width="match_parent"
android:layout_height="40dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/taskNameEditText"
android:textAlignment="center"
android:hint="enter task name"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/scrollLinearLayout">
</LinearLayout>
</HorizontalScrollView>
<Space
android:layout_width="match_parent"
android:layout_height="40dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/fromTimeEditText"
android:layout_weight="1"
android:hint="fromTime"
android:textAlignment="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/toTimeEditText"
android:layout_weight="1"
android:hint="toTime"
android:textAlignment="center" />
</LinearLayout>
</LinearLayout>
if you are using toolbar then you can change
toolbar.getNavigationIcon().setColorFilter(getResources().getColor(R.color.blue_gray_15), PorterDuff.Mode.SRC_ATOP);
The below picture shows that there are vertical "lines" running down the sides of each side of the screen. The background image seems to fill most of the screen but then there are these lines and the picture does not line up. See where I marked these lines with the black arrows. There seems to be no horizontal lines at the top and bottom of the screen. I cannot find any reason for this.
Below is some relevant code that might be where the problem is residing.
AndroidManifest.xml
<activity
android:label="#string/app_name"
android:name=".MainMenu"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
Here is a section of my styles.xml that is referenced in my AndroidManifest.xml.
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
EDIT
Just to clarify, this problem occurs on all the layouts, not just the one below.
mainmenu.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/relativelayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:paddingTop="75dp"
android:textSize="60sp" />
<LinearLayout
android:id="#+id/linearlayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical"
android:fillViewport="true"
android:paddingTop="175dp" >
<TextView
android:id="#+id/playBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="12dp"
android:textSize="30sp"
android:background="#color/transparent"
android:textColor="#color/onclicktextviewhighlight" />
<TextView
android:id="#+id/highscoresBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="12dp"
android:textSize="30sp"
android:background="#color/transparent"
android:textColor="#color/onclicktextviewhighlight" />
<TextView
android:id="#+id/optionsBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="30sp"
android:background="#color/transparent"
android:textColor="#color/onclicktextviewhighlight" />
</LinearLayout>
</RelativeLayout>
because you have padding in your layout
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingBottom="5dp"
android:paddingTop="5dp"
The padding. Like tyczj said. Also there IS a horizontal line
i want to set height of rating bar to 23 dp & width to 110 dp .
here is image(url) of layout i require :
here is my xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="#color/white"
android:padding="2dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView1"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_margin="5dp" />
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
android:paddingTop="5dp">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="waiter_one"
android:textColor="#color/black"
/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dfddd"
android:layout_marginTop="3dp" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ssss" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1710 votes"
android:layout_gravity="bottom" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/rateing_bg" />
</LinearLayout>
//Commented code of rating bar
comment(start)
<RatingBar
android:id="#+id/ratingBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:maxWidth="110dp"
android:maxHeight="23dp" /> comment(end)
</LinearLayout>
</LinearLayout>
code of rating bar is commented .If i remove comment then causing lot of problem.
You have to use a style for your rating bar,for example:
<style name="foodRatingBarSmall" parent="#android:style/Widget.RatingBar.Small">
<item name="android:progressDrawable">#drawable/food_ratingbar_small</item>
<item name="android:minHeight">16dip</item>
<item name="android:maxHeight">16dip</item>
</style>
For more details Check This.