小编SHA*_*LAN的帖子

android.util.AndroidRuntimeException:您无法将自定义标题与其他标题功能组合在一起

嗨我的代码得到错误.你能告诉我如何解决这个问题吗?

样式代码

 <style name="AppTheme" parent="AppTheme.Base"/>
 <style name="AppTheme.Base" parent="Theme.AppCompat.Light">
Run Code Online (Sandbox Code Playgroud)

活动代码

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // To set the custom title with Button
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.create_account_screen_1);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
    R.layout.title_layout_with_two_button);

    ((TextView) findViewById(R.id.myTitle)).setText(R.string.create_acc);
//  ((Button) findViewById(R.id.back_button)).setText(R.string.login);
    ((Button) findViewById(R.id.right_button)).setVisibility(View.INVISIBLE);
Run Code Online (Sandbox Code Playgroud)

清单代码

<activity android:name=".CreateAccountActivity1" 
          android:theme="@style/AppTheme"/>
Run Code Online (Sandbox Code Playgroud)

**create_account_screen_1**

 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#fafafa"
        android:orientation="vertical" >
        <View
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:background="@android:color/black"  />


        <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:orientation="vertical"
                android:paddingRight="5dp"
                android:paddingTop="3dp" 
                android:id="@+id/scrollview_bottom">
                <TextView 
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="5sp"
                    android:textSize="@dimen/default_size"
                    android:textColor="@color/black"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:text="@string/step_1_2"  
                    android:visibility="gone"   />
                <TextView 
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="5sp"
                    android:layout_marginTop="10sp"
                    android:textSize="@dimen/default_size"
                    android:textColor="@color/black" …
Run Code Online (Sandbox Code Playgroud)

android android-activity

5
推荐指数
1
解决办法
5506
查看次数

标签 统计

android ×1

android-activity ×1