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










share|improve this question




















  • 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, 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















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










share|improve this question




















  • 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, 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













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










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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














  • 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, 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








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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

How to ignore python UserWarning in pytest?

Alexandru Averescu