Как будет выглядеть макет XML для этого? - PullRequest
0 голосов
/ 09 сентября 2011

Это, вероятно, очень тупой вопрос, но у меня было несколько вопросов о том, как выглядит XML макета для этих элементов списка

enter image description here

Я знаю, что есть три текстовых просмотра, но как они оставили отступ в последней строке? Кроме того, как они вызвали перенос второго текстового представления после заданного количества строк?

Если бы кто-то мог опубликовать образец XML, это тоже было бы здорово.

Ответы [ 3 ]

0 голосов
/ 09 сентября 2011

используйте следующий xml, последнее текстовое представление справа.

0 голосов
/ 09 сентября 2011

Рецепт - ScrollView + TextView + LinearLayout + гравитация. Для того же взгляда, проверьте:

<?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>

(Вы можете заменить TextView s на ListView)

РЕДАКТИРОВАТЬ: Я думаю, что все дают вам немного решения здесь:).

0 голосов
/ 09 сентября 2011

Последний TextView либо является макетом, выровненным вправо (layout_gravity), либо совпадает с шириной родительского элемента и имеет гравитацию (не макет, а собственный) вправо.

Чтобы создать эллипсис для второго TextView, задайте ему допустимую высоту, а затем установите для атрибута ellipsize значение end.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...