Android - 修复图标的位置

时间:2016-10-12 06:10:51

标签: android android-layout

我有两个RelativeLayouts,每个ImageView包含TextViewTextView。点击TextView后,Textview的尺寸会增加,另一个ImageView的尺寸会减小。但是,textview的位置也会发生变化。我想要修复图像,而不管<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/bb_bottom_bar_outer_container" android:layout_width="match_parent" android:layout_height="60dp" android:background="@drawable/float_common" android:clickable="true"> <LinearLayout android:id="@+id/btn_updatenow" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background_grey" android:orientation="horizontal" android:weightSum="3"> <RelativeLayout android:id="@+id/float_layout_home" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" android:paddingTop="2dp"> <ImageView android:id="@+id/float_image_home" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="@dimen/margin_6" android:background="@drawable/float_home_onclick" /> <TextView android:id="@+id/float_text_home" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:paddingBottom="@dimen/margin_10" android:text="@string/home" android:textColor="@color/text_mid_grey" /> </RelativeLayout> <RelativeLayout android:id="@+id/float_layout_offers" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical" android:paddingTop="2dp"> <ImageView android:id="@+id/float_offers" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="@dimen/margin_6" /> <TextView android:id="@+id/float_text_offers" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:paddingBottom="@dimen/margin_10" android:text="@string/offers" android:textColor="@color/text_mid_grey" /> </RelativeLayout> </LinearLayout> </FrameLayout> 的大小。应该做出哪些改变?

<external-url>
<url>www.google.com</url>
</external-url>

  function loadWebApplication(startUrl) {
    //* trust Unsecure Cert for UAT
    cordova.plugins.certificates.trustUnsecureCerts(true)

    if (getInternetConnectionStatus()) {
        _startUrl = startUrl + "?appUUID=" + getAppUuid(win);

        //* call in app browser to open startUrl
        if (win.device.platform == 'iOS') {
            //* different in app browser option for ios
            _inAppBrowserHandler = window.open(_startUrl, '_blank', 'location=no,toolbar=no');
        } else if (win.device.platform == 'Android') {
            //* different in app browser option for Android         
            _inAppBrowserHandler = window.open(_startUrl, '_blank', 'location=yes');
        }


        _inAppBrowserHandler.addEventListener('loadstart', onInAppBrowserStart);
        _inAppBrowserHandler.addEventListener('loadstop', onInAppBrowserStop);
        _inAppBrowserHandler.addEventListener('loaderror', onInAppBrowserLoadError);
        _inAppBrowserHandler.addEventListener('exit', onInAppBrowserExit);
    } else {
        doc.location.href = "error.html";
    }

}

1 个答案:

答案 0 :(得分:2)

尝试将2 RelativeLayout的android:layout_width设置为0dp。

当Linearlayout包含许多视图并将layout_weight设置为1时,使用layout_height或layout_width = 0dp,以便为两个视图占用相等的空间。