English 中文(简体)
方言中的相对衰变具有额外空间
原标题:RelativeLayout in dialog has extra space
  • 时间:2010-09-03 00:31:55
  •  标签:
  • android

我正试图提醒大家,这种规模在内容上。 文字内容可能比方言要大,因此必须能够进行滚动。 如果我使用相关语言,无论情况有多大,只要没有足够的文字来补充案文,就会留下很多额外空间。 这是法典:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingTop="6dip"
    android:paddingLeft="12dip"
    android:paddingRight="12dip"
    android:paddingBottom="2dip"
>
<CheckBox 
    android:id="@+id/saleListingCheckbox" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:text="Save sale"
  android:textColor="#fff"
  android:layout_alignParentBottom="true"
    >
</CheckBox>
<ScrollView 
    android:id="@+id/saleListingLinear"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:layout_above="@id/saleListingCheckbox"
    android:layout_alignParentTop="true"
    >
    <TextView
        android:id="@+id/saleListingTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       android:textColor="#fff"
       android:textSize="7pt"
       android:paddingBottom="4dip"
    />
</ScrollView>
</RelativeLayout>

java代码:

@Override
protected boolean onTap(int index) {
    if (overlays.isEmpty()) {
        return false;
    }
    final SaleOverlayPushPin saleItem = overlays.get(index);

    AlertDialog alertDialog = new AlertDialog.Builder(context).create();
    alertDialog.setButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });

    LayoutInflater inflater = context.getLayoutInflater();
    dialogView = inflater.inflate(R.layout.sale_listing, null);

    textView = (TextView) dialogView.findViewById(R.id.saleListingTextView);

    checkbox = (CheckBox) dialogView.findViewById(R.id.saleListingCheckbox);
    checkbox.setOnCheckedChangeListener(this);

    alertDialog.setView(dialogView);

    alertDialog.setTitle(saleItem.getTitle());
    textView.setText(saleItem.getSnippet());
    checkbox.setTag(saleItem);
    checkbox.setChecked(saleItem.isSelected());

    alertDialog.show();

    return true;
}

这里,它所看的数据很少,数据很多:

“alt

我得以利用线索开展工作,但是,如果案文内容比方言要大,则我有一个不同的问题,即它会切断检查箱。 守则和屏幕:

<?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:paddingTop="6dip"
    android:paddingLeft="12dip"
    android:paddingRight="12dip"
    android:paddingBottom="2dip"
    android:orientation="vertical"
>
<ScrollView 
    android:id="@+id/saleListingLinear"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
  android:layout_weight="1"
  android:layout_gravity="top"
    >
    <TextView
        android:id="@+id/saleListingTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       android:textColor="#fff"
       android:textSize="7pt"
       android:paddingBottom="4dip"
    />
</ScrollView>
<CheckBox 
    android:id="@+id/saleListingCheckbox" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:text="Save sale"
  android:textColor="#fff"
  android:layout_weight="1"
  android:layout_gravity="bottom"
    >
</CheckBox>
</LinearLayout>

“alt“alt

我更希望,“边缘数据”行为像“线性数据”和“数据位置”等工作,如“相关数据”。 这是可能的吗?

UPDATE: bart s Solutions for the LinearLayout work betterly. 消除甲型六氯环己烷的排他性-重量是关键。

然而,相对 停业仍然不能像预期的那样奏效。 如果文本意见中的数据足够大,则使Box无法理解。 我仍然很想知道,如果有可能,如何解决相关争端。 见下文:

“alt

最佳回答

寻找相关替代物的工作布局(一般而言,如果你不希望额外空间的话,你不应同时使用统一安排和统一字典):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingTop="6dip"
    android:paddingLeft="12dip"
    android:paddingRight="12dip"
    android:paddingBottom="2dip"
>

<ScrollView 
    android:id="@+id/saleListingLinear"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"

    android:layout_alignParentTop="true"
    >
    <TextView
        android:id="@+id/saleListingTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       android:textColor="#fff"
       android:textSize="7pt"
       android:paddingBottom="4dip"
    />
</ScrollView>

<CheckBox 
    android:id="@+id/saleListingCheckbox" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:text="Save sale"
    android:textColor="#fff"
    android:layout_below="@id/saleListingLinear"
    >
</CheckBox>
</RelativeLayout>

班轮停工(从检查箱中删除重量):

<?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:paddingTop="6dip"
    android:paddingLeft="12dip"
    android:paddingRight="12dip"
    android:paddingBottom="2dip"
    android:orientation="vertical"
>
<ScrollView 
    android:id="@+id/saleListingLinear"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
  android:layout_weight="1"
  android:layout_gravity="top"
    >
    <TextView
        android:id="@+id/saleListingTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       android:textColor="#fff"
       android:textSize="7pt"
       android:paddingBottom="4dip"
    />
</ScrollView>
<CheckBox 
    android:id="@+id/saleListingCheckbox" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:text="Save sale"
  android:textColor="#fff"
  android:layout_gravity="bottom"
    >
</CheckBox>
</LinearLayout>
问题回答

这个问题是老的,但我要指出另一种解决办法。

我只是以不断扩大的清单观点和底线来看待这一问题。

I wound up using a edition of the Android Layout Weight Solutions.

我有一份名单和一份线性文件(含我的 but子)。 很显然,采用布局技术,迫使人们看上去各州和扩大名单。





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

热门标签