English 中文(简体)
Columns in ListView Anders
原标题:Columns in ListView Android

我怎么能够把一栏列列入安文的口号? 我有这份清单。

<?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="horizontal">
    <TextView android:layout_weight=".3" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/hour"
        android:gravity="center" />
    <ImageView android:id="@+id/symbol" android:scaleType="fitCenter"
        android:layout_gravity="center_horizontal" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_weight=".5" />
    <TextView android:layout_weight=".8" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/temperature"
        android:gravity="center" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/percipitation"
        android:gravity="center" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/wind_speed"
        android:gravity="center" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:id="@+id/wind_direction"
        android:gravity="center" />
</LinearLayout>

问题在于风向从“4”改为“300”时,各栏没有统一。

The problem

谁能够用固定的排气,使用完全独立于装置的宽度?

最佳回答

考虑使用表格而不是清单。 这是为了有行文和栏目。 See Hello TableLayout

为增加课程,你可以取消表Row,并在表Layout增加意见。

问题回答

您可以使用布局的重量——与布局的混合体的重量——在贵方的物品Xml中就这样:

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:id="@+id/relativeLayout1" 
    android:layout_width="fill_parent"  
    android:layout_height="fill_parent" >  

    <TextView  
         android:id="@+id/text1" 
         android:layout_width="0dp"  
         android:layout_height="wrap_content" 
         android:layout_weight="1"/>  

    <TextView  
         android:id="@+id/text2" 
         android:layout_width="0dp"  
         android:layout_height="wrap_content" 
         android:layout_weight="2"/>
</LinearLayout>

基本上,零散的排出迫使所有案文都认为无动于衷。 由于线性布局中的备用宽度根据布局而被冲淡――在案文的宽度确定之后,你开始在案文箱中打一个甚至游戏场,所有字面(0)相同。 由于没有宽度,案文箱从不同的宽度开始,加上额外空间(通过布局加权重)仍然使案文箱的宽度不同。

两者结合。 使用表Layout,而不是对清单项目包裹使用线塔。 我认为,我曾经看到过这项工作。 从来没有尝试过。

http://www.vbsteven.be/blog/using-the-simpleadapter-with-a-listview-in-android/

如果你掌握大量数据,则不使用表Layout。 表演和记忆消耗是可怕的。 显示你的数据可能需要很多秒钟,而且你会发现,你所想的在国联校进行过多处理时,会发生霍乱。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签