編集:
ListView の背景画像の設定に問題があります。アクティビティのグラフィカル ビューでは見栄えがよくなりますが、電話では背景がまったくありません。それは私の活動.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="match_parent"
android:orientation="vertical"
android:gravity="bottom|fill_vertical"
android:background="@drawable/background">
<ListView
android:id="@+id/listPlan"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@null"
android:cacheColorHint="#00000000"
android:listSelector="@android:color/transparent"
android:scrollingCache="false"
android:dividerHeight="5dp" >
</ListView>
</LinearLayout>
それが私の問題にとって何かを意味する場合、それは GroupActivity のアクティビティの 1 つです。私はすべてを試しました - android:background
for ListView
、 for LinearLayout
、親アクティビティ ( GroupActivity
) に対しても与え、可能なすべてのアイテムの値を変更android:layout
しましたが、何も役に立ちません。
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="20sp"
android:padding="15dp"
android:scrollHorizontally="true" >
</TextView>
これは私の単一のリスト項目がどのように見えるかです。おそらくいくつかの間違いがありますか?
私が編集して<TextView>
それを与えたときにのみ違いが見られましたandroid:background
。他のすべての人が背景を変更しようとしましたが、このリストビューは見当たりませんでした-たとえば、変更android:cacheColorHint="#00000000"
しましたandroid:cacheColorHint="#FFFFFFFF"
-何も起こりませんでした。
もう一度試してみます - レイアウトを Linear から Relative に変更した後、何も起こりませんでしたが、これは (@Sam のおかげで) 考えさせられます。たぶん、AndroidManifest.xml に何かを追加する必要がありますか? コードが正常に動作する場合、この親GroupActivity
が に大きな影響を与えている可能性があるのではないListView
かと考えました。残念ながら画像を掲載することはできませんが、ListView
ここで 2 つの状態を確認できます:
https://www.dropbox.com/sh/y5dgibei5uq9kv9/afeIvgW18g
うわー、問題は少し奇妙です。なぜなら、設定しようとしたときにandroid:textColor
何も変わらなかったからListView
です!
これは私のstyles.xmlです:
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
返信ありがとうございます。
最終編集!
さて、問題は解決しました。何も役に立たないので、別の方法を試して、ListViewの背景をコードに設定しました:
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
list.setBackgroundResource(R.drawable.background);
else list.setBackgroundResource(R.drawable.background_landscape);
今、すべてがうまくいっています!返信ありがとうございます。安らかに。