2017-03-20 13 views
0

私のコードのデザイン部分では、センターやアプリにスピナーがありますが、アプリケーションを実行すると上に表示されます。私はこれを修正する方法を見て、何も動作していません。誰でも何かを提案できますか?Spinnerはセンターには表示されません(Androidスタジオ)

はここに私のXMLです:https://gist.github.com/liliycode/43e45cd39c765716aebbdea4a4c08b89

、必要であれば、ここに私のjavaです:

https://gist.github.com/liliycode/50246841d81a65ec177283ec0a488b52

答えて

3

あなたはこのような質問のためのドキュメントを見てみる必要があります。

ドキュメントhereでお勧めするように、私は通常Relative Layoutを使用します。

centerInParent,およびcenterVerticalは、これらの場合に完全に機能します。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="American Writers" 
     android:textAppearance="@style/TextAppearance.AppCompat.Display1" 
     android:layout_centerHorizontal="true"/> 

    <Spinner 
     android:id="@+id/spinner" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:entries="@array/author_names" 
     android:layout_centerInParent="true"> 

    </Spinner> 

</RelativeLayout> 

私はそれが役に立てば幸い:それらを使用して

例、。

+0

ああ、わかりました。これは、多くの助け、ありがとう。 – Sam

+0

@Samあなたの問題を解決した場合は、これを回答としてマークする必要があります – hellyale

関連する問題