1

https://docs.google.com/document/d/1SDDnAG-jkQjC6F85iPgfv3Et1pYl8t03k-TkCN3YcCw/edit


在庫とカスタムリストアイテムが混在するAndroid設定ページがあります。カスタムリストアイテム「Mood」と「MixedMood」は、参照されているGoogleドキュメントのスクリーンショットに表示され、次のように機能します。(外部リンクは、少なくとも10の評判がなければ、stackoverflowで画像を投稿することが許可されていないためです...)

1)ユーザーが値を選択する前に、ユーザーは単にタイトルを表示します。(MoodまたはMixedMoodのいずれか)

2)ユーザーが値を選択すると、タイトルとカスタムツールチップ(小さな色付きの四角)が表示され、選択内容が示されます。

問題:スクリーンショットから、ユーザーが値を選択する前に、「ムード」テキストが中央に配置されていないことがわかります。中央に配置し、選択後にカスタムツールチップ用のスペースを動的に作成したいと思います。言い換えれば、私は

<TextView android:id="@+android:id/title" 

に対応するには

android:gravity="center_vertical". 

これは可能ですか?

私のレイアウトファイルは次のようになります。


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:minHeight="60dip"
    android:gravity="center_vertical"
    android:paddingRight="?android:attr/scrollbarSize">

    <RelativeLayout 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:gravity="center_vertical" 
         android:layout_marginLeft="15dip" 
         android:layout_marginRight="6dip"> 

        <TextView android:id="@+android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:gravity="center_vertical"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textSize="18sp"/>
        <!-- This image represents the dropdown arrow -->
        <ImageView
            android:gravity="center_vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_toRightOf="@android:id/title"
            android:scaleType="fitEnd"
            android:src="@drawable/ic_btn_round_more_normal_cropped" />

        <monarca_rct.client.customcomponents.MoodScalePresentation
            android:id="@+android:id/hpmp_mood_scale"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@android:id/title"
            android:paddingTop="4.0dp"/>

    </RelativeLayout>

</LinearLayout>
4

2 に答える 2

0

あなたの質問が正しければ:

android:layout_alignWithParentIfMissing="true"詳細については、 http://developer.android.com/resources/articles/layout-tricks-efficiency.html<TextView android:id="@+android:id/title"ご覧ください。

于 2012-05-07T19:44:00.650 に答える