My list view disappear after I change the background of the list view?
up vote
-1
down vote
favorite
I'm new to android and here is my problem when I tried to change the list view background by an image.
Here is my xml codes when I try to change the background list view to an image
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/loading_screen_background"
android:scaleType="centerCrop"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/travel"
android:textSize="20sp"
android:text="@+id/travel"
android:drawableLeft="@drawable/ic_launcher_chicago"
/>
here is my Java class which I bind the array to a list
package net.androidbootcamp.cityguide;
import android.app.ActionBar;
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String attraction={"Art Institute of Chicago", "Magnificent Mile" , "Willis Tower", "Navy Pier","Water Tower"};
setListAdapter(new ArrayAdapter<>(this,R.layout.activity_main,R.id.travel,attraction));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
switch(position){
case 0:
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://artic.edu")));
break;
case 1:
startActivity(new
Intent(Intent.ACTION_VIEW,Uri.parse("http://themagnificentmile.com")));
break;
case 2:
startActivity(new Intent(MainActivity.this, Willis.class));
break;
case 3:
startActivity(new Intent(MainActivity.this,Pier.class));
break;
case 4:
startActivity(new Intent(MainActivity.this,Water.class));
break;
}
}
}
here is my style .xml which I was told to change
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat">
<!-- Customize your theme here. -->
<!--item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item-->
</style>
</resources>
Here is the output after I modified the list view
Here is the original one
java android android-studio
add a comment |
up vote
-1
down vote
favorite
I'm new to android and here is my problem when I tried to change the list view background by an image.
Here is my xml codes when I try to change the background list view to an image
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/loading_screen_background"
android:scaleType="centerCrop"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/travel"
android:textSize="20sp"
android:text="@+id/travel"
android:drawableLeft="@drawable/ic_launcher_chicago"
/>
here is my Java class which I bind the array to a list
package net.androidbootcamp.cityguide;
import android.app.ActionBar;
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String attraction={"Art Institute of Chicago", "Magnificent Mile" , "Willis Tower", "Navy Pier","Water Tower"};
setListAdapter(new ArrayAdapter<>(this,R.layout.activity_main,R.id.travel,attraction));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
switch(position){
case 0:
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://artic.edu")));
break;
case 1:
startActivity(new
Intent(Intent.ACTION_VIEW,Uri.parse("http://themagnificentmile.com")));
break;
case 2:
startActivity(new Intent(MainActivity.this, Willis.class));
break;
case 3:
startActivity(new Intent(MainActivity.this,Pier.class));
break;
case 4:
startActivity(new Intent(MainActivity.this,Water.class));
break;
}
}
}
here is my style .xml which I was told to change
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat">
<!-- Customize your theme here. -->
<!--item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item-->
</style>
</resources>
Here is the output after I modified the list view
Here is the original one
java android android-studio
2
Please don't post screenshots of code, XML, or logcat output. Please post all text as text.
– Mike M.
Nov 21 at 19:54
1
^ agreed. Please post full code which is related to the problem. Even within the images, I cannot find the code for your listview and the data in your array seems to contain different data compared to the images. I would strongly recommend you to paste in your code before this question gets downvoted.
– Nero
Nov 21 at 20:06
how can I done something like that on stack overflow ?
– BeAmazedVariable
Nov 21 at 22:08
Hi there ! can you guys check the code for me by any chance ?
– BeAmazedVariable
Nov 22 at 18:59
If you mean that the only thing you changed was those colors, then it seems that the text is now a color that blends in with the background. Find your definitions forcolorPrimary
,colorPrimaryDark
, andcolorAccent
, and simply adjust them so that doesn't happen. They're usually in a file namedcolors.xml
underres/values/
.
– Mike M.
yesterday
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I'm new to android and here is my problem when I tried to change the list view background by an image.
Here is my xml codes when I try to change the background list view to an image
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/loading_screen_background"
android:scaleType="centerCrop"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/travel"
android:textSize="20sp"
android:text="@+id/travel"
android:drawableLeft="@drawable/ic_launcher_chicago"
/>
here is my Java class which I bind the array to a list
package net.androidbootcamp.cityguide;
import android.app.ActionBar;
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String attraction={"Art Institute of Chicago", "Magnificent Mile" , "Willis Tower", "Navy Pier","Water Tower"};
setListAdapter(new ArrayAdapter<>(this,R.layout.activity_main,R.id.travel,attraction));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
switch(position){
case 0:
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://artic.edu")));
break;
case 1:
startActivity(new
Intent(Intent.ACTION_VIEW,Uri.parse("http://themagnificentmile.com")));
break;
case 2:
startActivity(new Intent(MainActivity.this, Willis.class));
break;
case 3:
startActivity(new Intent(MainActivity.this,Pier.class));
break;
case 4:
startActivity(new Intent(MainActivity.this,Water.class));
break;
}
}
}
here is my style .xml which I was told to change
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat">
<!-- Customize your theme here. -->
<!--item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item-->
</style>
</resources>
Here is the output after I modified the list view
Here is the original one
java android android-studio
I'm new to android and here is my problem when I tried to change the list view background by an image.
Here is my xml codes when I try to change the background list view to an image
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/loading_screen_background"
android:scaleType="centerCrop"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/travel"
android:textSize="20sp"
android:text="@+id/travel"
android:drawableLeft="@drawable/ic_launcher_chicago"
/>
here is my Java class which I bind the array to a list
package net.androidbootcamp.cityguide;
import android.app.ActionBar;
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String attraction={"Art Institute of Chicago", "Magnificent Mile" , "Willis Tower", "Navy Pier","Water Tower"};
setListAdapter(new ArrayAdapter<>(this,R.layout.activity_main,R.id.travel,attraction));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
switch(position){
case 0:
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://artic.edu")));
break;
case 1:
startActivity(new
Intent(Intent.ACTION_VIEW,Uri.parse("http://themagnificentmile.com")));
break;
case 2:
startActivity(new Intent(MainActivity.this, Willis.class));
break;
case 3:
startActivity(new Intent(MainActivity.this,Pier.class));
break;
case 4:
startActivity(new Intent(MainActivity.this,Water.class));
break;
}
}
}
here is my style .xml which I was told to change
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat">
<!-- Customize your theme here. -->
<!--item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item-->
</style>
</resources>
Here is the output after I modified the list view
Here is the original one
java android android-studio
java android android-studio
edited Nov 22 at 18:59
asked Nov 21 at 19:52
BeAmazedVariable
62
62
2
Please don't post screenshots of code, XML, or logcat output. Please post all text as text.
– Mike M.
Nov 21 at 19:54
1
^ agreed. Please post full code which is related to the problem. Even within the images, I cannot find the code for your listview and the data in your array seems to contain different data compared to the images. I would strongly recommend you to paste in your code before this question gets downvoted.
– Nero
Nov 21 at 20:06
how can I done something like that on stack overflow ?
– BeAmazedVariable
Nov 21 at 22:08
Hi there ! can you guys check the code for me by any chance ?
– BeAmazedVariable
Nov 22 at 18:59
If you mean that the only thing you changed was those colors, then it seems that the text is now a color that blends in with the background. Find your definitions forcolorPrimary
,colorPrimaryDark
, andcolorAccent
, and simply adjust them so that doesn't happen. They're usually in a file namedcolors.xml
underres/values/
.
– Mike M.
yesterday
add a comment |
2
Please don't post screenshots of code, XML, or logcat output. Please post all text as text.
– Mike M.
Nov 21 at 19:54
1
^ agreed. Please post full code which is related to the problem. Even within the images, I cannot find the code for your listview and the data in your array seems to contain different data compared to the images. I would strongly recommend you to paste in your code before this question gets downvoted.
– Nero
Nov 21 at 20:06
how can I done something like that on stack overflow ?
– BeAmazedVariable
Nov 21 at 22:08
Hi there ! can you guys check the code for me by any chance ?
– BeAmazedVariable
Nov 22 at 18:59
If you mean that the only thing you changed was those colors, then it seems that the text is now a color that blends in with the background. Find your definitions forcolorPrimary
,colorPrimaryDark
, andcolorAccent
, and simply adjust them so that doesn't happen. They're usually in a file namedcolors.xml
underres/values/
.
– Mike M.
yesterday
2
2
Please don't post screenshots of code, XML, or logcat output. Please post all text as text.
– Mike M.
Nov 21 at 19:54
Please don't post screenshots of code, XML, or logcat output. Please post all text as text.
– Mike M.
Nov 21 at 19:54
1
1
^ agreed. Please post full code which is related to the problem. Even within the images, I cannot find the code for your listview and the data in your array seems to contain different data compared to the images. I would strongly recommend you to paste in your code before this question gets downvoted.
– Nero
Nov 21 at 20:06
^ agreed. Please post full code which is related to the problem. Even within the images, I cannot find the code for your listview and the data in your array seems to contain different data compared to the images. I would strongly recommend you to paste in your code before this question gets downvoted.
– Nero
Nov 21 at 20:06
how can I done something like that on stack overflow ?
– BeAmazedVariable
Nov 21 at 22:08
how can I done something like that on stack overflow ?
– BeAmazedVariable
Nov 21 at 22:08
Hi there ! can you guys check the code for me by any chance ?
– BeAmazedVariable
Nov 22 at 18:59
Hi there ! can you guys check the code for me by any chance ?
– BeAmazedVariable
Nov 22 at 18:59
If you mean that the only thing you changed was those colors, then it seems that the text is now a color that blends in with the background. Find your definitions for
colorPrimary
, colorPrimaryDark
, and colorAccent
, and simply adjust them so that doesn't happen. They're usually in a file named colors.xml
under res/values/
.– Mike M.
yesterday
If you mean that the only thing you changed was those colors, then it seems that the text is now a color that blends in with the background. Find your definitions for
colorPrimary
, colorPrimaryDark
, and colorAccent
, and simply adjust them so that doesn't happen. They're usually in a file named colors.xml
under res/values/
.– Mike M.
yesterday
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419582%2fmy-list-view-disappear-after-i-change-the-background-of-the-list-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Please don't post screenshots of code, XML, or logcat output. Please post all text as text.
– Mike M.
Nov 21 at 19:54
1
^ agreed. Please post full code which is related to the problem. Even within the images, I cannot find the code for your listview and the data in your array seems to contain different data compared to the images. I would strongly recommend you to paste in your code before this question gets downvoted.
– Nero
Nov 21 at 20:06
how can I done something like that on stack overflow ?
– BeAmazedVariable
Nov 21 at 22:08
Hi there ! can you guys check the code for me by any chance ?
– BeAmazedVariable
Nov 22 at 18:59
If you mean that the only thing you changed was those colors, then it seems that the text is now a color that blends in with the background. Find your definitions for
colorPrimary
,colorPrimaryDark
, andcolorAccent
, and simply adjust them so that doesn't happen. They're usually in a file namedcolors.xml
underres/values/
.– Mike M.
yesterday