http://stackoverflow.com/questions/2372415/how-to-change-color-of-android-listview-seperator-line.
For now, I'll change it to his:
android:layout_width="fill_parent" android:textColor="@color/text_color"
android:divider="#FF000000" android:dividerHeight="4sp"
android:focusable="false">
Ok, I got the lines, but they're black. Worse, the top and bottom aren't covered.
I'm having some trouble figuring how to set the border, as opposed to divider line. A border will get the top and bottom of the list. Is it the view, or the ListView? Let's look at some apis from Eclipse...
Well, the view doesn't seem to offer much hope. How about ListView?
As usual SO to the rescue:
http://stackoverflow.com/questions/2658772/android-vertical-line-xml
Something like:
Ok, next up, is how to get a scroll vie around the text display; sometimes the text is too long and pushes the button off the bottom of the display.
We'll try the selected answer from http://stackoverflow.com/questions/1748977/making-textview-scrollable-in-android:
"You don't need to use a ScrollView actually. Just set the android:maxLines and android:scrollbars = "vertical" properties of textview in layout xml file. Then use the TexView.setMovementMethod(new ScrollingMovementMethod()) in the Code. Bingo!!!! It scrolls automatically w/o any issues.
But surely maxLines requires you to enter an arbitrary number; this isn't something that will work for every screen size and font size? I find it simpler to just wrap it with a ScrollView, meaning I don't have to add any further XML attributes or code (like setting the movement method). – Christopher Dec 19 '10 at 22:57"
Let's see what happens if we just use scroll view.
android:paddingLeft="0dp" android:layout_gravity="center_vertical|center_horizontal"
android:textSize="30sp" android:textColor="@color/text_color" />
No, I think I need to set maxlines.
Ok, I ended up with this:
android:scrollbars="vertical">
android:paddingLeft="10dp" android:layout_gravity="center_vertical|center_horizontal"
android:textSize="30sp" android:textColor="@color/text_color" />
android:textSize="15dp" android:layout_gravity="center_vertical|center_horizontal"
android:textColor="@color/text_color" android:background="@drawable/custom_button"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
Along with the line of code:
mDisplayEnglish = (TextView) findViewById(R.id.display_english);
mDisplayEnglish.setMovementMethod(new ScrollingMovementMethod());
And it scrolls. Ok, I'm going to get rid maxlines, since I have height specified. At this point, I'm going to just commit.
No comments:
Post a Comment