2011-09-08 10 views
0

これはおそらく非常にばかな質問ですが、私は3 textviewsがある知っているが、それらがどのようにインデント左でしたレイアウトXMLは、これらのリスト項目レイアウトXMLはどのように見えるでしょうか?

enter image description here

のためにどのように見えるかについていくつかの質問を持っていました最後の行ですか?また、どのようにして、2行目のtextviewが設定された行数の後に折り返されるのでしょうか?

誰かがサンプルXMLを投稿することができたら、それはすばらしいことになります。

+0

それはむしろカスタムリストビューです。最後のテキストは、gravityプロパティを使用してrightに設定されます。テキストビューをx行数に制限するには、setMaxLines(x)を使用します。 – Raunak

答えて

0

次のxmlを使用します。最後のtextviewは右側です。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 
    <TextView 
     android:maxLines="2" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
    /> 
    <TextView 
     android:maxLines="5" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
    /> 
    <TextView 
     android:layout_gravity="right" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
    /> 


</LinearLayout> 
0

最後TextViewには、右(layout_gravity)に整列いずれかのレイアウトである、またはそれは親の幅と一致し、右にその重力(ないレイアウト1、それ自身を)持っています。

2番目のTextViewを省略し、有効な高さを与え、ellipsize属性をendに設定します。

0

レシピはScrollView + TextView + LinearLayout + gravityです。 同じ外観のために、チェック:

<?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="fill_parent" 
    android:orientation="vertical"> 


<ScrollView 
    android:id="@+id/sv" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 
    <TextView 
    android:layout_width="fill_parent" 
    android:textSize="24dip" 
    android:layout_height="wrap_content" 
    android:text="Morning" 
    /> 
    <TextView 
    android:layout_width="fill_parent" 
    android:textSize="14dip" 
    android:layout_height="wrap_content" 
    android:text="Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout in a vertical orientation, presenting a vertical array of top-level items that the user can scroll through. " 
    /> 
    <TextView 
    android:layout_width="fill_parent" 
    android:textSize="12dip" 
    android:layout_height="wrap_content" 
    android:text="Morning" 
    android:gravity="right" 
    /> 
     <TextView 
    android:layout_width="fill_parent" 
    android:textSize="24dip" 
    android:layout_height="wrap_content" 
    android:text="Morning" 
    /> 
    <TextView 
    android:layout_width="fill_parent" 
    android:textSize="14dip" 
    android:layout_height="wrap_content" 
    android:text="Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout in a vertical orientation, presenting a vertical array of top-level items that the user can scroll through. " 
    /> 
    <TextView 
    android:layout_width="fill_parent" 
    android:textSize="12dip" 
    android:layout_height="wrap_content" 
    android:text="Morning" 
    android:gravity="right" 
    /> 
    <TextView 
    android:layout_width="fill_parent" 
    android:textSize="24dip" 
    android:layout_height="wrap_content" 
    android:text="Morning" 
    /> 
    <TextView 
    android:layout_width="fill_parent" 
    android:textSize="14dip" 
    android:layout_height="wrap_content" 
    android:text="Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout in a vertical orientation, presenting a vertical array of top-level items that the user can scroll through. " 
    /> 
    <TextView 
    android:layout_width="fill_parent" 
    android:textSize="12dip" 
    android:layout_height="wrap_content" 
    android:text="Morning" 
    android:gravity="right" 
    /> 
</LinearLayout> 
</ScrollView> 

</LinearLayout> 

EDIT(あなたがListViewTextView Sを置き換えることができます):私は誰もがここにあなたのソリューションのビットを与えていると思います:)。