2012-04-17 5 views
3

xmlを書きましたが、まだテキストを画面の中央にイメージとして配置します。 私のイメージの後にテキストを入れたい。 私のXMLでは、画像の下の中央にテキストを配置しようとしています。 私のxmlは:イメージビューの下にテキストを配置する方法

<?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="wrap_content" 
    android:background="#ffffffff" 
    android:gravity="fill" > 

    <ViewFlipper 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/flipper" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_alignParentBottom="true" 
     android:flipInterval="2000" > 

     <LinearLayout 
      android:id="@+id/Linear" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:baselineAligned="false" 
      android:orientation="vertical" > 

      <ImageView 
       android:id="@+id/imageLabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:src="@drawable/logonews" /> 

      <TextView 
       android:id="@+id/textLabel" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/imageLabel" 
       android:layout_gravity="center" 
       android:singleLine="true" 
       android:text="Israel News" 
       android:textSize="18sp" 
       android:textStyle="bold" /> 
     </LinearLayout> 
    </ViewFlipper> 

</RelativeLayout> 
+0

はあなたの問題を解決? –

答えて

9

CompoundDrawableがニーズを満たしていない場合は、代わりにこのようなLinearLayoutRelativeLayoutを使用することがあります。

<RelativeLayout 
     android:id="@+id/relative" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <ImageView 
      android:id="@+id/imageLabel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 
      android:src="@drawable/logonews" /> 

     <TextView 
      android:id="@+id/textLabel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/imageLabel" 
      android:layout_centerInParent="true" 
      android:singleLine="true" 
      android:text="Israel News" 
      android:textSize="18sp" 
      android:textStyle="bold" /> 
    </RelativeLayout> 
関連する問題