3.2.10 Scroll
Refer
this SO
for some discussion about multi-line TextView. Some argues that
android:inputType="textMultiLine"
is for
EditView
but may work for TextView.
For scroll TextView,
refer to this SO,
might(some say no)
need to set android:scrollbars
= "vertical" and
android:maxLines
and add this in code: myTextView.setMovementMethod(new
ScrollingMovementMethod());
Other
suggestion is to embed the TextView into ScrollView, just do NOT
specify
android:layout_height="fill_parent"
A
cool feature in Cheesesquare
sample is auto hide or show app bar with scroll event. Refer to
AppBarLayout,
SO,
CoordinatorLayout:
it is all in layout xml, first add this for the
android.support.v7.widget.Toolbar:
app:layout_scrollFlags="scroll|enterAlways|snap"
Second,
add this to all nested view:
app:layout_behavior="@string/appbar_scrolling_view_behavior".
This works with RecyclerView,
but not with TextView.
One way is to put the TextView
inside a NestScrollView
as below, and no need calling setMovementMethod
for scroll:
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/tvInfo" android:layout_width="match_parent"
Refer to this SO
for ScrollView inside another ScrollView. Should never use a
HorizontalScrollView
with a ListView.
3.2.11 Theme, Color and Style
Here
are some good guide:
Right
shows three themes: Holo Dark, Holo Light and Holo Light with Dark
Bar. This can be changed later by modifying
res/values/styles.xml
and
res/values-vXX/styles.xml
,
or change app style directly in manifest file like this:
android:theme="@android:style/Theme.Black"
For
changing style of spinner, this SO
is old and might be out-date. Refer to spinner.
Set android:popupBackground
in layout xml of Spinner to config the background does take effect.
But set android:spinnerItemStyle
doesn't work,
might because code:
mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item);
Refer to R.layout
and simple_spinner_dropdown_item.xml:
style="?android:attr/spinnerDropDownItemStyle"
This SO
mentioned you can override
android:dropDownSpinnerStyle
,
android:spinnerDropDownItemStyle
,
and even android:dropDownListViewStyle
attribute of the theme, but no detail how.
Method
from this post
does work, the xml files should be put under layout. Little issue
with the simple_spinner_item.xml line:
android:layout_height="
?android:
attr/dropdownListPreferredItemHeight"
is causing error:
Attribute
is not public. To
solve this problem, refer to SO
and SO,
or change it to "?android:attr/listPreferredItemHeight"
,
which has too big gap. But change to “wrap_content” make it too
tight. Remove “?android:”
is just fine for me. Then to change the size and color of the text,
add this
android:textSize="14sp"
and
android:textColor="#ffffff"
to both xml and
it works perfect with small white text.
3.2.12 CardView, RecycleView and Coverflow
For
CoverFlow, refer to this SO.
As it mentioned, the close one is the Gallery
widget. Two code are availabe at:
http://www.inter-fuser.com/2010/01/android-coverflow-widget.html
which is a little old(2010), and
http://code.google.com/p/android-coverflow/
which is based on above one.
0 Comments:
Post a Comment