是否可以增加进度条Android内部线条的高度

时间:2017-05-15 10:49:23

标签: android progress-bar height

是否可以增加进度条内线的高度? enter image description here

5 个答案:

答案 0 :(得分:3)

我这样修好了:

我在drawable文件夹中创建了一个自定义进度条xml文件:

progress_bar_states.xml:

    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">

  <item android:id="@android:id/background">
    <shape>
      <corners android:radius="5dip" />
      <gradient
        android:startColor="@color/colorGray"
        android:centerColor="@color/colorGray"
        android:endColor="@color/colorGray"
      />
    </shape>
  </item>



  <item android:id="@android:id/progress">
    <clip>
      <shape>
        <corners android:radius="5dip" />
        <gradient
          android:startColor="@color/colorBlue"
          android:centerColor="@color/colorBlue"
          android:endColor="@color/colorBlue"
        />     
      </shape>
    </clip>
  </item>



</layer-list>

在我的布局中:

              <ProgressBar
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:indeterminateOnly="false"
                android:id="@+id/progressBar"
                android:gravity="left"
                android:progressDrawable="@drawable/progress_bar_states"
                android:layout_weight="1"
                android:layout_marginBottom="10dp"
                android:layout_marginLeft="15dp" />

答案 1 :(得分:1)

请尝试以下代码:

mProgressBar.setScaleY(3f);

答案 2 :(得分:0)

以编程方式设置进度的布局。 使用如下代码。

        ProgressBar progressBar = new ProgressBar(teste.this, null, android.R.attr.progressBarStyleHorizontal);

        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(300, 10);

        progressBar.setLayoutParams(params );
        LinearLayout linearLayout = new LinearLayout(getApplicationContext());
        linearLayout.addView(progressBar);
        setContentView(linearLayout);

答案 3 :(得分:0)

在activity_main.xml中

在ProgressBar部分

更改

style="?android:attr/progressBarStyleHorizontal"

style="@android:style/Widget.ProgressBar.Horizontal"

答案 4 :(得分:0)

只需使用 export class Cart Badge Icon extends Component { constructor(props){ super(props); } render() { return ( <> <Image source={this.props.is-focused ? IMP_CONT.CART_ACTIVE : MG_CONT.CART_INACTIVE} style={{ width: scale(25), height: scale(22) }} /> {this.props.counterproductive ? (<View > <Text>{this.props.cart Count} </Text> </View> ) : null} </> ) } } cont map State To Props = (state) => ({ cart Has Product Flag: state.cart.cart Has Product, cart Count: state.cart.cart Count, }) export default connect(map State To Props)(Cart Badge Icon) and i have import this component in my bottom Tab like this <Cart Badge Icon/> !您可以将其增加到 function get_price(){ $var_id = get_field('id_producto_lifehuni', $post_id); $ch_lf = curl_init('https://app.milifehuni.com/public/ws/get_price/'.$var_id); curl_setopt($ch_lf, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch_lf, CURLOPT_HEADER, 0); $lf_data = curl_exec($ch_lf); curl_close($ch_lf); echo $lf_data; } add_action('wp_head','get_price'); 并且高度更大!

android:scaleY="4f"

enter image description here