来自链接布局preference类别的Android获取视图 [英] Get view from linked layout in Preference Category Android
本文介绍了来自链接布局preference类别的Android获取视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何从一个链接的布局的意见,preference活动。
I want to know how to get the views from a linked layout in preference activity.
<PreferenceCategory android:key="HEADER"
android:layout="@layout/prefernce_top_layout"
android:title="Application Settings" >
我想从prefernce_top_layout.xml的意见...
目前,我这样做,但无法获得浏览..
I want to get the views from "prefernce_top_layout.xml"... Currently I am doing this but unable to get View..
addPreferencesFromResource(R.layout.
userProfilePic = (ImageView)this.findViewById(R.id.profile_DP_settings);
请帮助!谢谢
推荐答案
请一个独立的用户界面,并在onCreat方法加载它是这样的:
Make a separate UI and load it like this in onCreat method:
addPreferencesFromResource(R.xml.preference);
setContentView(R.layout.prefernce_top_layout);
<RelativeLayout
android:id="@+id/headerLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/profile_DP_settings"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="10dp"
android:src="@drawable/appicon"
android:visibility="gone" />
<TextView
android:id="@+id/fbUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/profile_DP_settings"
android:layout_toRightOf="@+id/profile_DP_settings"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="gone" />
</RelativeLayout>
<ListView
android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/headerLayout" />
这篇关于来自链接布局preference类别的Android获取视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文