English 中文(简体)
发现 ViewBy Id on Customs Owner Bar within Tab Activities
原标题:findViewById on Custom Title Bar within Tab Activity

我的口号是我的习惯。 海关名称栏中载有文字学和图像学。 该表有多个表格。

我想做的是获取表格中的图像观察资源。

我正在从主要Tab活动(延伸到Tabac)的习俗所有权交易中获取书面意见,并且正在做罚款。 下面是主要活动罚款的法典:

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.myactivity);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mycustomtitle);
TextView tv = (TextView) findViewById(R.id.viewTitleId);

现在我想在我的表格中查阅《图像评论》(在表Host中添加)。 如果我把以下编码列入表格:

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

它有以下错误:

You cannot combine custom titles with other title features

如果在表格中直接规定如下:

getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mycustomtitle);
ImageView image = (ImageView) findViewById(R.id.imageTitleId);

形象依然无效。

mycustomtitle.xml has following two elements:

<TextView 
     android:layout_width="0dp"
     android:layout_height="wrap_content" 
     android:layout_weight="0.80"
     android:id="@+id/viewTitleId"
     android:textColor="@color/titleBarTextColor"
     android:gravity="center_vertical"
     android:text="@string/viewText"
     android:textSize="18px"
     android:paddingLeft="45px"
     />

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="0dp" 
            android:layout_weight="0.20"
    android:src="@drawable/btn_save" 
    android:id="@+id/imageTitleId"
    >
</ImageView>

请给我某种想法,我如何能够在表格中查阅习惯名称的图像。

最佳回答

可通过在<条码>中公布<条码>的公开静态。 然后,在<代码>Sub-Actative上,你显然可以查阅普通静态文字和图像评论等。

Main_Tab_Activity.textView.setText("my_text_view");
问题回答

如果你只将习俗所有权限制在主轴上,则所有权限制将出现在你所有的辅助行为中。

例例:

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main_layout);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.header_layout);
TextView tv = (TextView) findViewById(R.id.viewTitleId);
ImageView image = (ImageView)findViewById(R.id.imageTitleId);

没有必要在你们所有的分区活动中给予。

a 新员额。 页: 1

用途

getParent().getWindow().findViewById(id)

insted id findViewById(id); for access any view of parent.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签