从Android TV中的BrowseFragment中删除上边距

时间:2016-10-27 09:08:13

标签: android android-tv browsefragment

如何删除空格,如{ "responseHeader":{ "status":0, "QTime":5 }, "response":{ "numFound":8, "start":0, "docs":[ { "id":"NOK5", "name":"One Krone", "manu_id_s":"nor", "price_c":"1,NOK", "payloads":[ "ABC|110.0" ], "_version_":1549328956822388700, "last_updated":"2016-10-27T08:00:33.785Z" }, { "id":"NOK4", "name":"One Krone", "manu_id_s":"nor", "price_c":"1,NOK", "payloads":[ "ABC|90.0" ], "_version_":1549328945950752800, "last_updated":"2016-10-27T08:00:23.417Z" }, ... ] }, "debug":{ "rawquerystring":"payloads:ABC", "querystring":"payloads:ABC", "parsedquery":"payloads:ABC", "parsedquery_toString":"payloads:ABC", "explain":{ "NOK5":" 52.870323 = weight(payloads:ABC in 1) [], result of: 52.870323 = score(doc=1,freq=1.0), product of: 7.2711983 = queryWeight, product of: 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = queryNorm 7.2711983 = fieldWeight in 1, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = fieldNorm(doc=1) ", "NOK4":" 52.870323 = weight(payloads:ABC in 1) [], result of: 52.870323 = score(doc=1,freq=1.0), product of: 7.2711983 = queryWeight, product of: 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = queryNorm 7.2711983 = fieldWeight in 1, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = fieldNorm(doc=1) ", "NOK150":" 52.870323 = weight(payloads:ABC in 0) [], result of: 52.870323 = score(doc=0,freq=1.0), product of: 7.2711983 = queryWeight, product of: 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = queryNorm 7.2711983 = fieldWeight in 0, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = fieldNorm(doc=0) ", "NOK3":" 52.870323 = weight(payloads:ABC in 1) [], result of: 52.870323 = score(doc=1,freq=1.0), product of: 7.2711983 = queryWeight, product of: 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = queryNorm 7.2711983 = fieldWeight in 1, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = fieldNorm(doc=1) ", "NOK7":" 52.870323 = weight(payloads:ABC in 2) [], result of: 52.870323 = score(doc=2,freq=1.0), product of: 7.2711983 = queryWeight, product of: 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = queryNorm 7.2711983 = fieldWeight in 2, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = fieldNorm(doc=2) ", "NOK1":" 52.870323 = weight(payloads:ABC in 0) [], result of: 52.870323 = score(doc=0,freq=1.0), product of: 7.2711983 = queryWeight, product of: 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = queryNorm 7.2711983 = fieldWeight in 0, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = fieldNorm(doc=0) ", "NOK2":" 52.870323 = weight(payloads:ABC in 1) [], result of: 52.870323 = score(doc=1,freq=1.0), product of: 7.2711983 = queryWeight, product of: 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = queryNorm 7.2711983 = fieldWeight in 1, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = fieldNorm(doc=1) ", "NOK6":" 52.870323 = weight(payloads:ABC in 2) [], result of: 52.870323 = score(doc=2,freq=1.0), product of: 7.2711983 = queryWeight, product of: 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = queryNorm 7.2711983 = fieldWeight in 2, product of: 1.0 = tf(freq=1.0), with freq of: 1.0 = termFreq=1.0 7.2711983 = idf(docFreq=8, maxDocs=4762) 1.0 = fieldNorm(doc=2) " }, "QParser":"LuceneQParser", "timing":{ ... } } } 下方图片中的虚线框所示。我设法删除搜索按钮和标题。虽然,我也想删除空格并在屏幕顶​​部移动视频行。

有没有办法做到这一点?

我尝试在我的AppTheme中设置以下内容,但我怀疑它有帮助:

BrowseFragment

enter image description here

3 个答案:

答案 0 :(得分:7)

您可以使用 <select id="boh_corridor" name="boh_corridor"> <option value=""></option> <option value="Yes" class="green">Yes</option> <option value="No" class="red">No</option> </select> 库中提供的dimens.xml来执行此操作。

  

v17 Lean Back

  1. 转到Follow the steps below first. - &gt; sdk - &gt; extras - &gt; android - &gt; support - &gt; v17 - &gt; leanback - &gt; res

  2. 从他们的副本values文件到您当前的leanback项目dimens.xml文件夹。

  3. 现在项目values文件夹中有dimens.xml个文件。

  4. 打开该文件,然后找到values

  5.   

    默认值可能是dimen

    167dp
      

    因此请将其更改为<dimen name="lb_browse_rows_margin_top">167dp</dimen> 左右或根据您的需要。

    30dp

    您将在<dimen name="lb_browse_rows_margin_top">30dp</dimen> 中获取行。

答案 1 :(得分:0)

如果您只需要删除片段中的标题边距而不是全局覆盖BrowseFragment:

    @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    FrameLayout containerDock = (FrameLayout) view.findViewById(R.id.browse_container_dock);
    FrameLayout.MarginLayoutParams params = (FrameLayout.MarginLayoutParams) containerDock.getLayoutParams();
    Resources resources = inflater.getContext().getResources();
    int newHeaderMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, resources.getDisplayMetrics());
    int offsetToZero = -resources.getDimensionPixelSize(R.dimen.lb_browse_rows_margin_top);
    params.topMargin = offsetToZero+newHeaderMargin;
    containerDock.setLayoutParams(params);
    return view;
}

答案 2 :(得分:-1)

IanZ解决方案完美运行。获取主容器的其他方法是 主片段中的currentPath,没有覆盖FrameLayout containerDock = getView().findViewById(R.id.browse_container_dock);方法。