2017-11-02 4 views
0

これは私が作業しているデザインの一部です。画像に示すようにフラットです。 desired design ここに実装されているバージョンがあります。この影は何であっても取り除くことができず、CardViewコンポーネントだけでなく、すべてのビューの周りにあります。ここアンドロイドはすべての私のビューの周りに影を追加します、どうすれば削除できますか?

implemented version

Iがゼロに上昇もゼロのLinearLayout標高を設定しようと、何もここ

を変更しない設定に示すようcardView

<android.support.v7.widget.CardView 
     xmlns:card_view="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/product_item_card" 
     android:layout_gravity="center" 
     android:layout_width="match_parent" 
     android:layout_height="300dp" 
     android:layout_margin="@dimen/margin" 
     android:layout_marginTop="@dimen/half_margin" 
     android:layout_marginBottom="@dimen/half_margin" 
     android:background="@color/color_foreground" 
     card_view:cardCornerRadius="5dp" 
     android:elevation="0dp" 
     card_view:cardPreventCornerOverlap="false"> 

するためのコードである含む別の例でありますLinearLayoutはEditTextとボタンの周りにもあることに注意してください。

ここ

は、ここではここで描画可能

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle"> 
    <corners 
     android:radius="5dp"/> 
    <solid android:color="@color/lightGrey"></solid> // #ADADAD 
    <stroke android:width="1dp" android:color="@color/grey"/> 
</shape> 

されているのEditText

<EditText 
     android:id="@+id/fragment_product_details_amount_et" 
     android:layout_width="60dp" 
     android:layout_height="30dp" 
     android:layout_gravity="center" 
     android:layout_marginLeft="10dp" 
     android:background="@drawable/rounded_corners_with_border_grey" 
     android:inputType="number" 
     android:text="1" 
     android:textAlignment="center" /> 

ためのコードである私のstyles.xmlほとんどdefauls

<resources> 
    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/color_primary</item> 
     <item name="colorPrimaryDark">@color/color_primary_dark</item> 
     <item name="colorAccent">@color/color_accent</item> 
    </style> 

    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
    </style> 

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 

    <style name="FullscreenTheme" parent="AppTheme"> 
     <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item> 
     <item name="android:windowActionBarOverlay">true</item> 
     <item name="android:windowBackground">@null</item> 
     <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item> 
     <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item> 
    </style> 

    <style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar"> 
     <item name="android:background">@color/black_overlay</item> 
    </style> 

</resources> 

更新: CardViewとボタンは@ ZeroOneの指示に従って修正されました。 LinearLayoutとEditTextの問題は依然として続きます。 サンプルコードが追加されました。

更新:問題固定

+0

フラットにボタンをstyle="?android:attr/borderlessButtonStyle"を追加する可能性のある重複: 追加され

更新のstyles.xml [アンドロイドでカードビューのシャドービューを無効にする方法](https://stackoverflow.com/questions/26776058/how-to-disable-the-shadowaround-card-view-in-android) –

+0

@NorthernPoetそれは単なるカードではないeditTextとLinearLayout –

+0

LinearLayoutとEditTextにはデフォルトで影がありません。あなたのスタイルをチェックしてください。 –

答えて

2

使用card_view:cardElevation="0dp"の代わりandroid:elevation="0dp"

とボタンのための...ちょうど

+0

LinearLayoutとEditTextについて –

+0

LinearLayoutとEdittextにスタイルがありません。styles.xmlを確認してください。 – ZeroOne

+0

にはstyles.xmlが追加されています。罫線や影については何もありません –

関連する問題