Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在对话框中设置textview的对齐方式_Android - Fatal编程技术网

Android 在对话框中设置textview的对齐方式

Android 在对话框中设置textview的对齐方式,android,Android,尝试将所有内容集中在对话框中。搜索栏居中,我使用的图像按钮居中,但无论我做什么,我似乎都无法将文本视图居中 以下是该对话框的代码: 在文本视图中使用android:gravity=“center” <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@str

尝试将所有内容集中在对话框中。搜索栏居中,我使用的图像按钮居中,但无论我做什么,我似乎都无法将文本视图居中

以下是该对话框的代码:


在文本视图中使用android:gravity=“center”

<TextView
    android:id="@+id/textView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/pick_color"
    android:textAlignment="center" 
    />

<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <ImageButton
        android:layout_width="@dimen/large_brush"
        android:layout_height="@dimen/large_brush"
        android:layout_margin="2dp"
        android:background="#FF0000"
        android:layout_weight="1"
        android:tag="FF0000" />
    <ImageButton
        android:layout_width="@dimen/large_brush"
        android:layout_height="@dimen/large_brush"
        android:layout_margin="2dp"
        android:background="#CC66FF"
        android:layout_weight="1"
        android:tag="CC66FF" />
    <ImageButton
        android:layout_width="@dimen/large_brush"
        android:layout_height="@dimen/large_brush"
        android:layout_margin="2dp"
        android:background="#FFFF66"
        android:layout_weight="1"
        android:tag="FFFF66" />
    <ImageButton
        android:layout_width="@dimen/large_brush"
        android:layout_height="@dimen/large_brush"
        android:layout_margin="2dp"
        android:background="#66CCFF"
        android:layout_weight="1"
        android:tag="66CCFF" />
    <ImageButton
        android:layout_width="@dimen/large_brush"
        android:layout_height="@dimen/large_brush"
        android:layout_margin="2dp"
        android:background="#99FF33"
        android:layout_weight="1"
        android:tag="99FF33" />
    <ImageButton
        android:layout_width="@dimen/large_brush"
        android:layout_height="@dimen/large_brush"
        android:layout_margin="2dp"
        android:background="#000000"
        android:layout_weight="1"
        android:tag="#000000" />
</LinearLayout>

<TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/brsh_size"
    android:textAlignment="center" />

<SeekBar
    android:id="@+id/seekBar1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/ersr_size"
    android:textAlignment="center" />

<SeekBar
    android:id="@+id/seekBar2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/use_pic"
    android:textAlignment="center"
    android:textAppearance="?android:attr/textAppearanceLarge" />