2016-09-08 98 views
1

enter image description here嗨在DetailsFragment更改的操作按钮默认选择颜色,在Leanback的图书馆

我想更改默认的背景颜色的亮起动作按钮选择在细节fragment.Any想法的颜色如何同样可以成就了吗?

+0

检查并按照下面的答案,让我知道你是否面临任何问题。 –

+0

你有没有试过我的答案? –

回答

3

您可以使用库提供的styles.xml来执行此操作。

Follow the steps below first

  1. 转到您的sdk - >extras - >android - >support - >v17 - >leanback - >res - >values

  2. 从那里复制styles.xml文件到您当前的leanback项目文件夹中。

  3. 现在您的项目中有style.xml文件。

  4. 打开该文件,找到style

<style name="Widget.Leanback.DetailsActionButtonStyle" parent="Widget.Leanback.DetailsActionButtonStyleBase">

里面,您可以添加以下属性,你将有它的背景颜色改变。

<item name="android:background">@color/lb_speech_orb_recording</item> 

我测试了这个我的身边,它的工作让我知道你是否面临任何问题。

希望这会帮助你得到你需要的东西。

+0

所以,你还要添加leanback所指的所有维度,字符串和可绘制对象吗? – prit

+0

是的,它工作.Thanx。 – prit

1

在其它方式,

有可能使用DetailsOverviewRowPresenter这样设置;

private void setupDetailsOverviewRowPresenter() { 
    // Set detail background and style. 
    DetailsOverviewRowPresenter detailsPresenter = 
       new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter()); 
    detailsPresenter.setBackgroundColor(getResources().getColor(R.color.details_fragment_background_color)); 
}