2016-08-08 4 views
0

標高をウィジェットレイアウトに追加しようとしています。私はそれにアンドロイドを置いた:ルートのレイアウトの高さ、私も子供の相対レイアウトに入れてみました。Android:標高をウィジェットに追加

<RelativeLayout 
    android:id="@+id/main_layout" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/widget_background" 
    android:elevation="30dp"> 

    <RelativeLayout 
     android:id="@+id/widget_bad_data_text" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:visibility="visible"> 

     <ImageView 
      android:id="@+id/widget_no_data_icon" 
      android:layout_width="@dimen/widget_1x1_icon_width_height" 
      android:layout_height="@dimen/widget_1x1_icon_width_height" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="@dimen/widget_1x1_margin_top"/> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/widget_no_data_icon" 
      android:text="@string/widget" 
      android:layout_centerHorizontal="true" 
      android:fontFamily="sans-serif-light" 
      android:textColor="@android:color/white" 
      android:textSize="@dimen/widget_1x1" 
      tools:ignore="UnusedAttribute,SpUsage" /> 

    </RelativeLayout> 

</RelativeLayout> 

答えて

0

基本コンテナにelevationを追加しています。標高効果を確認するには、マージンを30dpに設定します。

関連する問題