English 中文(简体)
当活动从背景到地面时,纽芬兰文的定本突然从上到下游不等。
原标题:When activity comes from background to foreground, text layout of buttons suddenly ranges from top to bottom

我在跟踪非常奇怪的行为。 我的部分布局产生了这些纽州:

“entergraph

这是相应的规定:

 <TableLayout
    android:id="@+id/mainscreenButtonbar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_gravity="bottom"
    android:gravity="bottom"
    android:stretchColumns="*" >

    <TextView
        android:id="@+id/statusBar"
        style="@style/StatusBarStyle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/connecting" />

    <TableRow 
        style="@style/ButtonStyle">
      <Button
            android:id="@+id/btnReport"       
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/blitzerMelden"
            android:textSize="18sp" />

        <Button
            android:id="@+id/btnConfigurations"
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/bundeslaender"
            android:textSize="18sp" />
    </TableRow>
</TableLayout>

这里使用的是:

<style name="ButtonStyle">
    <item name="android:background">#212121</item>
</style>

<style name="StatusBarStyle">
    <item name="android:textSize">11sp</item>
    <item name="android:background">#212121</item>
    <item name="android:padding">2sp</item>
</style>

现在,如果而且只有在这种活动进入背景(点击“HOME”)并恢复的情况下,才会发生一些奇怪的情况。 表面上,纽芬兰文从上到底:

“entergraph

我不理解为什么发生这种情况。 这并不取决于案文。 当我删除案文时,行为是相同的。 当我使用线索(没有本文本意见)而不是本表Layout时,行为是正确的,案文没有改动:

 <LinearLayout
        android:id="@+id/mainscreenButtonbar"
        style="@style/ButtonStyle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_alignParentBottom="true"
        android:gravity="bottom"
        android:stretchColumns="*" >

        <Button
            android:id="@+id/btnReport"
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/blitzerMelden"
            android:textSize="18sp" />

        <Button
            android:id="@+id/btnConfigurations"
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/bundeslaender"
            android:textSize="18sp" />
    </LinearLayout>

因此,这一错误行为与表Layout有关,但如何? 任何想法?

<>>>>>


虽然它没有做任何特别的事情,但我补充说《Resume活动法》(我说,只有在恢复活动的时候,才发生,但只有我以前用紧急的饮水、环卫和讲卫生设备撤出。 如果我改变不同活动,或者甚至从新的活动开始,问题就会出现。

@Override
protected void onResume() {
    super.onResume();

    setConnectionText(getString(R.string.connecting));

    messageTable.removeAllViewsInLayout();

    Log.d(TAG, "> executing onResume");

    try {
        Log.d(TAG, "> reading config data");
        stateStates = dataProvider.getConfigData();
    } 
    catch (PolizeiwarnungException e) {
        Toast toast = Toast.makeText(this, "Fehler: " + e.getMessage(), 4000);
        toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.show();
    }

    try {
        String receivedJsonString = httpConnector.receiveData();
        HashMap<String, ArrayList<String>> messages = jsonParser.jsonStringToMessageMap(receivedJsonString);

        for (Map.Entry<String, Boolean> state : stateStates.entrySet()) {
            buildMessageTable(state.getKey(), state.getValue(), messages);
        }
    } 
    catch (PolizeiwarnungException e) {
        setConnectionText(getString(R.string.dataDownloadFailed));
        addTextToTable(getConnectionText());
    }

    TableRow tableRow = new TableRow(this);
    InvisibleButton invisibleButton = new InvisibleButton(this);

    tableRow.addView(invisibleButton);
    messageTable.addView(tableRow);
}

(可调用MessageTable在上文表Layout中增加收到的数据,因此没有影响这一问题)

问题回答

能够再一次尝试。 虽然我无法确切地重复你的错误,但我还是能够迫使纽州在回家后返回时不出示任何文本(空白 but子)。 我确定这一点,在Resume结尾处添加法典,在每个纽州铺设Text。 我认为,这也可以在你的情况中发挥作用,因为它可能迫使重新计算纽芬兰文。 是否值得尝试?





相关问题
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 ...

热门标签