2016-11-23 7 views
1
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <Button 
      style="?android:attr/buttonStyleSmall" 
      android:layout_width="70dp" 
      android:layout_height="55dp" 
      android:text="nope" 
      android:id="@+id/cancel_arrive" 
      android:onClick="selectNotGoing" 
      /> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:weightSum="1"> 

     <TextView 
      android:id="@+id/attendingEventInListviewRow" 
      android:layout_width="match_parent" 
      android:layout_height="28dp" 
      android:text="eventsName" 
      android:height="30sp" 
      android:textSize="22sp" 
      android:gravity="right" 
      android:tag="eventsName" 
      /> 

     <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:text="eventDayOfTheWeek" 
     android:textColor="#000000" 
     android:id="@+id/eventDayOfTheWeekTxt" 
      android:gravity="right" 

      /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:text="eventTime" 
     android:textColor="#000000" 
     android:id="@+id/eventTimeTxt" 
     android:gravity="right" 
     /> 

    </LinearLayout> 


</LinearLayout> 

ここで私が見つけた問題をGoogleに解決しようとしました。何も助けなかった。上のコードは私の現在のXMLです。右側にはeventNameeventDayOfTheWeekeventTimeが必要です。レイアウトの右側にテキストを揃えることができません

私はまた、プロジェクトをクリーニングして再構築しようとしましたが、同じままです。打ち上げ前

(プレビューではテキストはそれが左に行く打ち上げ後、右側にある)

(プレビューで):打ち上げ後http://prntscr.com/db0ekphttp://prntscr.com/db0f7t

(レイアウト

+0

私はそれを実行すると、テキストはTextViewsで右揃えです。あなたのケースで何が起きているのかを指定できますか? – weibeld

+0

私はプレビュー中に右側のテキストも見ていますが、私がアプリを起動すると左に移動します。 – Jack

+0

TextViewにさまざまな背景色を追加してください(例えば、 'android:background ="#FF0000 "')。何が起きているのか少し見てから、おそらく質問にスクリーンショットを投稿してください。 – weibeld

答えて

1

プレビューは、情報がなくても膨らんで表示されるレイアウトを「卸売り」レイアウトとみなして表示します。あなたのXMLコードはコンテナ内部にあります(ListView)。これはlayout_widthwrap_content(または固定値)に設定されている可能性があります。あなたのListViewmatch_parent(そしておそらくその親も)持っているはずです。特にActivityまたはFragmentの場合は、より多くのコードを表示してください。

+0

リストビューのレイアウト幅をwrap_contentからparentと一致するように変更しました。ありがとう。 – Jack

関連する問題